Programmer's Guide to the Zeno Interpreter
Chapter 2. Data and declarations
The Zeno language supports two categories of data, constants and variables. Constants and variables must be declared before they are used. This is done with a declaration statement. Variables provide you with a workspace for performing arithmetic and logical operations. Constants allow you to set values which cannot be changed during execution of your program; this can help you to reduce the likelihood of errors in your programs.
Variable declarations
Declarations of variables must have the following form:
var name{, name} : type specification [:= expression]
Each name in the list is declared with the same type specification and is optionally initialized to the same expression value.
Constant declarations
Declaration of a constant uses this form:
const name : type specification := constant expression
The syntax of a constant declaration is similar to that of a variable declaration; however, only one name at a time is declared. A constant must be initialized when it is declared. A constant expression is one that can be evaluated before the program is executed.
literal constants
A literal real number, that is, one written into your source code, begins and ends with a digit and must contain a decimal point. A unary operator, + or -, can optionally precede the first digit. The following forms are valid:
-9.954 % fixed point notation
7.43e-4 % scientific notation
|