Bird has mutable and imutable variables. Types can be explicitly declared or inferred automatically. Values must be assigned during declaration.
Use the var keyword to create a normal mutable variable.
Use the const keyword to create an imutable variable that cannot be modified later.
Bird permits reassignment of mutable variables.
An already declared variable can be overwritten using the = operator.
Bird supports additional assigment operators: +=
, -=
, *=
, /=
, %=
.
Assignments can be integrated into expressions to modify a variable and return its updatedvalue.
Check out the playground!