diff options
author | michelou <michelou@epfl.ch> | 2008-05-20 14:25:02 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-05-20 14:25:02 +0000 |
commit | 3a0b0d40d7be5fb100a1b061aab54a4d4a51ae60 (patch) | |
tree | b8bae307ad9df5c04ff7a8d68a9be755a1a6a748 /test/files/run/tuples.scala | |
parent | c1f07338ed21e551446a5c98d262d738a9b7b0ce (diff) | |
download | scala-3a0b0d40d7be5fb100a1b061aab54a4d4a51ae60.tar.gz scala-3a0b0d40d7be5fb100a1b061aab54a4d4a51ae60.tar.bz2 scala-3a0b0d40d7be5fb100a1b061aab54a4d4a51ae60.zip |
int -> Int, etc..
Diffstat (limited to 'test/files/run/tuples.scala')
-rw-r--r-- | test/files/run/tuples.scala | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/test/files/run/tuples.scala b/test/files/run/tuples.scala index b03167adee..ff1b53fd11 100644 --- a/test/files/run/tuples.scala +++ b/test/files/run/tuples.scala @@ -1,30 +1,30 @@ import Function._ object Test extends Application { - var xyz: (int, String, boolean) = _ + var xyz: (Int, String, Boolean) = _ xyz = (1, "abc", true) Console.println(xyz) xyz match { case (1, "abc", true) => Console.println("OK") } - def func(x : int, y : String, z : double) : unit = { - Console.println("x = " + x + "; y = " + y + "; z = " + z); - } + def func(x: Int, y: String, z: Double) { + Console.println("x = " + x + "; y = " + y + "; z = " + z); + } - def params = (2, "xxx", 3.14159) // (*****) + sef params = (2, "xxx", 3.14159) // (*****) - tupled(func _)(params) // call the function with all the params at once - func(2, "xxx", 3.14159) // the same call - (func _).apply(2, "xxx", 3.14159) // the same call + tupled(func _)(params) // call the function with all the params at once + func(2, "xxx", 3.14159) // the same call + (func _).apply(2, "xxx", 3.14159) // the same call - // Composing a tuple - def t = (1, "Hello", false) + // Composing a tuple + def t = (1, "Hello", false) - // Decomposing a tuple - val (i, s, b) = t + // Decomposing a tuple + val (i, s, b) = t - // all the assertions are passed - assert(i == 1) - assert(s == "Hello") - assert(b == false) + // all the assertions are passed + assert(i == 1) + assert(s == "Hello") + assert(b == false) } |