Using Unicon’s declarations and data types
You can’t write a Unicon program without declaring things. Declaring something is the act of associating a name, visible within some scope and lifetime, with some chunk of code or memory capable of holding a value. Next, let’s learn how different program components can be declared.
Declaring program components
Unicon programs consist of one or more procedures beginning with main()
. Program structure may also include classes. Unicon distinguishes user-defined procedures from functions that are built into the language. The following patterns show the syntax structure for the primary declarations of bodies of code in Unicon’s procedures and methods:
- Declare procedure or method:
procedure X ( params ) [locals]* [initial] [exprs]* end method X ( params ) [locals]* [initial] [exprs]* end
All procedures and methods have a name, zero or more parameters, and a body ending with the word
end...