You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
508 B
Plaintext
30 lines
508 B
Plaintext
7 years ago
|
// tuple literal. (Tuple3)
|
||
|
(1,2,3)
|
||
|
|
||
|
// destructuring bind: tuple unpacking via pattern matching.
|
||
|
var (x,y,z) = (1,2,3)
|
||
|
|
||
|
// hidden error: each assigned to the entire tuple.
|
||
|
// BAD
|
||
|
var x,y,z = (1,2,3)
|
||
|
|
||
|
// list (immutable).
|
||
|
var xs = List(1,2,3)
|
||
|
|
||
|
// paren indexing. (slides)
|
||
|
// more on it: https://www.slideshare.net/Odersky/fosdem-2009-1013261/27
|
||
|
xs(2)
|
||
|
|
||
|
// cons.
|
||
|
1 :: List(2,3)
|
||
|
|
||
|
// range sugar.
|
||
|
1 to 5 // same as
|
||
|
1 until 6
|
||
|
1 to 10 by 2
|
||
|
|
||
|
// sole member of the Unit type (like C/Java void).
|
||
|
() //(empty parens)
|
||
|
|
||
|
|