To declare a variable as belonging to type type use: function(x:type,y:type=2) or local(x:type, y:type=2) or even for(i:type=... since in GP loop indices are local to the loop.