next up previous
Next: Effect of types declaration Up: Advanced use of gp2c Previous: gp2c types

Type declaration

To declare a variable as belonging to type type use:

function(x:type,y:type=2)
local(x:type, y:type=2)
global(x:type, y:type=2)
for(i:type=...

To declare several variables of the same type type at once, use:

local(x, y=2):type
global(x, y=2):type

You can even mix the two ways:

local(x, y:type2=2):type1
will declare x to be of type type1 and y of type type2.



Bill Allombert 2006-01-28