Idiom

The default parameters of the function
filter list val = positives = list.filter {it > 0}
the string interpolation println ( "name $ name")
type determines when (x) {
Single expression functions
instance method call to an object a plurality of
class {Turtle
Fun The penDown ()
Fun penUp ()
Fun Turn (degrees: Double)
Fun Forward (pixels: Double)
}
Val Turtle Turtle = ()
with (myTurtle) {
The penDown ()
for (I in 1..4) {
Forward (100.0)
Turn (90.0)
}
penUp ()
}

Guess you like

Origin blog.csdn.net/weixin_34174105/article/details/90921378