Content deleted Content added
→Tools: added <ref> |
→Semantics: more examples |
||
Line 53:
<source lang=Scala>
▲fun foo(maybeNull : String?, neverNull : Int)
{
// use of elvis operator
val name : String = maybe ?: "stranger"
println("Hello ${name}")
}
</source>
An example for the use of the safe navigation operator
<source lang=Scala>
// returns null if foo is null, or bar() returns null, or baz() returns null
foo ?. bar() ?. baz()
</source>
|