Page last modified on July 05, 2014, at 07:49 AM

As with other languages, causerie allows the programmer to define and use variables, which represent an item with a value that may change at runtime. Unlike other languages, variables in causerie all take up exactly the same amount of space, since they represent instances of an existing class -- objects.

Defining Variables

Variables may be defined with the var keyword. They may optionally be initialized with a value by calling the assignment method on the newly-minted variable:

// Define a simple variable
integer var myValue;

// Define and initialize a simple variable
float var pi := 3.14159;

// Define a variable which defaults to 'id'
var genericVariable;

As shown above, you may specify the name of the class which is used to create the instance to which each variable refers; this is roughly analogous to its type. In the example above, both integer and float name types that are defined by the runtime library?. If you omit the class, then the compiler assumes the variable is an uninitialized instance of id -- a generic pointer to an object.



recent changes

edit SideBar

All site content copyright © its various contributors.
Licensed under Creative Commons License