Skip to content

Instantly share code, notes, and snippets.

@ozw-sei
Created February 16, 2013 17:56
Show Gist options
  • Save ozw-sei/4967934 to your computer and use it in GitHub Desktop.
Save ozw-sei/4967934 to your computer and use it in GitHub Desktop.
Scala勉強中なう--変数と制御文-- ref: http://qiita.com/items/3b398c6688085ba27a36
text = "World,Hello!"
//こんな風に値を変えようとすると怒られます。
var num = 1
__//変数なので、後から値を変えることもできあmす。__
num = 2
val ten:Int = 10
def max(x:Int,y:Int):Int 等号
if(x>y) x //X返します
else y //y返します
}
var i =0
while(i<args.length){
println(args(i))
i+=1
}
1.args.foreach(arg => println(arg))//配列の要素を抽出して出力
2.args.foreach(println)//引数に関数を投げてます
3.for(arg <- args) println(arg)
var i =0
while(i<args.length){
if(i != 0){
print(" ")
}
print(args(i))
i += 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment