|
Note that == (double equal sign), not =, denotes equality; this distinguishes it from the assignment =. An optional colon (':') after the condition improves readability. Functional conditionals:
|
Where it is necessary to distinguish between passing arguments by value or by reference, describe it in English. Long program lines:
|
declare <variable-name> as <type> = <initial value> declare <variable-name> as array [<lower-bound> to <upper-bound>] of <type> |
type should be an english word or phrase describing the type Lower and upper bounds can be integers or chars. Note that an array declared [0 to 10] would have eleven elements: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10. Creating your own types: |
Array declarations: |
class <name_of_new_type> <variable declaration(s)> |
declare <array-name>[<lower-bound> to <upper-bound>] of <type> |
A "class" is a record containing variables called "fields" and optionally functions called "methods" that have an implied argument 'this'. Names of classes most often begin with a capital letter. An "object" is any variable whose type is a class. |
Composite data structures (also see Object Oriented Programming):
|
Example of accessing fields and methods of an object: |
Accessing fields of a composite structure: |
declare grohl as Foo ... var = grohl.height |
<structure variable name>.<field name> |