-
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'
-
val
orvar
- Marking with
val
indicates that the property is immutable, andvar
indicates that is it mutable.
- name
- Property names must follow
lowerCamelCase
naming standards.
- type (optional)
- Property types must follow
UpperCamelCase
naming 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