-
Notifications
You must be signed in to change notification settings - Fork 0
Basic Tutorial
A variable name in wardscript can contain letters a-z, A-Z , numbers: 0-9, and a few special symbols: _ $ '.
a := 12;
b := a, c := b;
There is only 4 data types in wardscript:
- Byte
- Nil
- Node
- Function
A byte is an unsigned integer lesser than 256
b1 := 0,
b2 := 255;
The Nil datatype represents the absence of value and is useful in data-structure implementation.
root := nil;
Note: nil is not a keyword, it's only a variable predefined in all programs
In dynamic data structures, a node is a record that contains a data of interest and at least one pointer to reference to another node.
A node in wardscript is similar to a structure in c, but dynamically typed as in python or lua (dictionary and table), it differs from these by being immutable; which means that once a node is created, it can not have new members or eliminate those that already exist, only modify its content.
To create a node write a list of assignments (members) between curly brackets { }.
root := {
data := 0,
next := nil
};
To modify a member value
root.data := 1;
A loop is equivalent to a while True or a while (1)