PScript – Part 8 – Functions

Functions are a critical part of any modern language, also in PScript. Functions must be declared before they area used. A PScript will start executing the first global statement it find, but it will parse and tag functions on it’s way – so a general good rule is to put the global PScript code at bottom of a file.

Func MyFunc(uint32 v1, uint32 v2) : uint32
   return v1*v2
end

uint32 x = MyFunc(2,2)
print (x)

This example should print 4.

The return value is optional.

Leave a Reply