You can declare a type as part of a var
declaration. To do that, after the
name of the variable (count
), put a colon followed by the name of a type
(e.g., Long
).
In many cases, we do not need to do this, as Kotlin will determine the type of the variable from the initial value.
You can learn more about this in:
Tags: