Cicada has four primitive variable types: bool, char, int, and double. Strings are lists of chars. Types bool and char each occupy one byte per datum, whereas the sizes of int and double depend on the definitions ccInt and ccFloat but default to C ints and doubles respectively.
In order to define a variable, use the define ‘::’ operator. Several variables of the same type can be defined on the same line.
height :: time :: g :: double
units :: string
All primitive variables get initialized to some starting value when first created. That value is: 0 for numeric variables (ints and doubles); the null character for char variables; false for Boolean variables; and an empty string for string variables.
The assignment operator can be written either ‘=’ as in C or ‘<-’. We’ll use the C convention.
g = -9.8
units = "m/s^2"
String constants are inside double quotes, character constants use single quotes, and Boolean constants are true and false. Unlike in C, Boolean values are not interchangeable with integers: (i::int) = true is illegal. However, characters can be treated as ints, so ((c::char) = 'c') = 27 is allowed.
For convenience, we can define and set variables in a single step using the := operator. So we could have written:
height :: time :: double
g := -9.8
units := "m/s^2"
Numeric types are assumed to be integers unless there’s a decimal point, so if we had rounded to g := 10 and omitted the decimal point, then ‘g’ would have had an integer type.
Last update: November 12, 2025