Florian
10/04/2019, 7:01 PMconst
as a standalone keyword instead of const val
? There is no other const
combination as far as I see itKirill Zhukov
10/04/2019, 7:35 PMKirill Zhukov
10/04/2019, 7:37 PMconst
, and can’t assign function results.Kirill Zhukov
10/04/2019, 7:39 PMconst
?Florian
10/04/2019, 7:40 PMKirill Zhukov
10/04/2019, 7:51 PMconst
is a modifier in this case, where as val
is a keyword. val
indicates a value that cannot be reassigned and by default it’s assigned in runtime.Kirill Zhukov
10/04/2019, 7:52 PMconst
is a modifier to a val
keyword, it says how the value is being assigned.Kirill Zhukov
10/04/2019, 7:53 PMKirill Zhukov
10/04/2019, 7:53 PMclass
keyword and private
modifierKirill Zhukov
10/04/2019, 7:54 PMprivateClass
keyword (since we have functions and other things) would be redundant, if it makes senseKirill Zhukov
10/04/2019, 7:54 PMconst
is more flexible this wayKirill Zhukov
10/04/2019, 7:55 PMFlorian
10/04/2019, 7:55 PMKirill Zhukov
10/04/2019, 7:58 PMKirill Zhukov
10/04/2019, 7:58 PMconst
modifier on functionsFlorian
10/04/2019, 8:00 PMFlorian
10/04/2019, 8:00 PMconst
can't be used somewhere else, or can it?Kirill Zhukov
10/04/2019, 8:00 PMKirill Zhukov
10/04/2019, 8:00 PMFlorian
10/04/2019, 8:05 PMilya.gorbunov
10/04/2019, 8:56 PMconst
is a soft keyword, that means it can be used in other places just as a usual identifier, e.g.
val const = kotlin.random.Random.nextInt()
println(const)
Kirill Zhukov
10/04/2019, 9:02 PMFlorian
10/04/2019, 9:46 PMFlorian
10/04/2019, 9:46 PMarekolek
10/05/2019, 10:01 AM