Basic variable functionality
Link to basic-variable-functionality
The most basic variable types of ZenScript are Strings, Integers and booleans.
Most single types
Link to most-single-types
true == true You can check if two values are the same.
"Hello" != "World" You can also check if two values are unequal.
Link to strings
Strings provide some functionality
"Hello".length Returns the string's length as int.
"Hello" Returns the character at the string's given index as another string.
"Hello" in "Hell" checks if the string before
in contains the string after it as boolean. You can replace the
has if you like that better.
"Hel" ~ "lo " + "World" You also can add/concatenate strings.
string += "assignAdd" you can also use the assignAdd/assignConcatenate operators.
Aside from these, all methods that are available to Java Strings and do not use the
char type are also available to ZenScript strings!
Link to integers
Integers provide some functionality
+-*/% Basic mathematic operators (check the variable Types page). You can also use the operatorAssign tokens
0 to 10 Returns an Integer Range ranging from 0 to 10.
1~10 Concatenates the Integers (returns "110").
Link to booleans
Booleans provide some functionality
true ~ false Concatenates the booleans (returns "truefalse").
& | ^ Boolean operators (and/or/xor).
Link to arraysarraylists
Arrays and ArrayLists provide common functions
array returns the item at the given index.
array = "Hello" Sets the item at the given index.
array.length returns the arrays length