The Sababa Programming Language

Variables

In Sababa, you do not have to declare variable types, however, note that in the mean time primitive types such as float and double do not exist. Declaring a variable is pretty straightforward and is done as follows:

sababa> def{var} 400

=> ()

The general structure is:

  • def{variable_name} variable_value

Some more examples to hopefully clear things up.

sababa> def{x} 300

=> ()

sababa> def{r} 500

=> ()

sababa> + x r

=> 800

sababa> def{r} 200

=> ()

sababa> + x r

=> 500

sababa> def{str} "Hello"

=> ()

In the first example, x got assigned the value 300 and r got the value of 500; which were than added to get 800.

In the second example we changed the value of r to 200, and added the reassigned r with x to get 500

In the final example, we assigned variable str the value of "Hello". I just wanted to show that a string/character types may be assigned to a variable.

Multi-Variable Assignment

Sababa supports multi-variable assignment on a single line, therefore, this would be an acceptable variable declaration.

sababa> def{x y z} 100 200 300

=> ()

Where x is assigned the value 100, y is assigned the value 200, and z is assigned the value of 300.