-
Unlike constants, variables can change their value at any time.
-
Like constants, variables may be integers, booleans and strings.
new[str]myvar="myvar worked."
To change its value, use:
myvar="myvar worked again.";
- Integers are whole numbers.
new[int]integer=1
- Booleans are variables that can either be true or false.
new[bool]boolean=true
- Strings are words or sequences of characters.
new[str]string="test"
- Doubles are numbers with decimal points.
new[double]decimal_point=3.14
- Single characters.
new[char]character='b'
- Integers that can't have a negative value.
new[int.unsigned]positivealways=-1
NOTE: If you assign a negative value, it'll be replaced with a positive value; in this case - the variable will have a value of 1 instead.
- Integers that can't have a negative value or a value bigger than 65535.
new[int.short]positivealways=-1; // Value will be set to 0.
new[int.short]theresalimit=65576; // Value will be set to 0.
NOTE: If you set a value that is smaller than 0 or bigger than 65535, value of the variable will be 0.
- Integers that take up to a mere byte of memory to store information (store values from -128 to 127).
new[byte]foobyte=743; // we will see 0
console.println("{foobyte}")
foobyte=-4847; // we will see 0
console.println("{foobyte}")
foobyte=128; // we will see 0
console.println("{foobyte}")
foobyte=127; // we will see 127
console.println("{foobyte}")
Check pointer documentation for more...
- This is a built-in instruction which returns an address of a symbol, most frequently a variable.
console.rawout(addressof?myvar)
Output:
1@1