Skip to content

Properties

Sxtanna edited this page Jul 9, 2020 · 4 revisions

Properties are very simple and have a signature of either 3 or 4 values.

Syntax

[val|var] 'name'{: 'type'} = 'expression'


  1. val or var
  • Marking with val indicates that the property is immutable, and var indicates that is it mutable.
  1. name
  • Property names must follow lowerCamelCase naming standards.
  1. type (optional)
  • Property types must follow UpperCamelCase naming standards, if not defined it will be inferred.
  1. expression
  • The assignment expression of a property is fully evaluated, and as such can be almost anything.

Examples

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