-
Notifications
You must be signed in to change notification settings - Fork 0
Properties
Sxtanna edited this page Jul 9, 2020
·
4 revisions
[val|var] 'name'{: 'type'} = 'expression'
-
valorvar
- Marking with
valindicates that the property is immutable, andvarindicates that is it mutable.
- name
- Property names must follow
lowerCamelCasenaming standards.
- type (optional)
- Property types must follow
UpperCamelCasenaming standards, if not defined it will be inferred.
- expression
- The assignment expression of a property is fully evaluated, and as such can be almost anything.
val name: Txt = "Sxtanna"
this can also be defined without a type
val name = "Sxtanna"
expressions will be evaluated before assigned to properties
val five = 3 + 2 // this will evaluate to 5 obviously...
example of reassignment
var number: Int = 0
number = 20