Mutable variable: var x = 5 // `Int` type is inferredįunction having two Int parameters with Int return type: fun sum ( a : Int, b : Int ) : Int Val c : Int // Type required when no initializer is providedĬ = 1 // definite assignment int a = 1 int b = 1 int c c = 1 Syntax Crash Course VariablesĪssign-once (read-only) local variable: val a : Int = 1 val b = 1 // `Int` type is inferred Take a look at this cheatsheet and quick reference.
0 Comments
Leave a Reply. |