Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
Scala /
20150313a
if / elseThe val s = if (x > 0) "sca" else "la" // s is either "sca" or "la", depending on x UnitThe equivalent of Block ( { … } )The value of a block is the value of its last expression. Thus, you can write such things as: scala> val x = { | val a = 5 // local variable of the block | val b = 3 | scala.math.pow(a, b) | } x: Double = 125.0 |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |