Pastey Phix wiki #2


There are three kinds of routines: procedure, function, and type. A procedure is packages action, a function returns a value, and a type declares and tests user defined data-types.

-- this is for action 
procedure hello() 
    ? "hello" 
    end procedure 
-- outputs: 
// hello 
-- this returns a value 
function pi() 
    return 3.14 
    end function 
    -- use a function in an expression 
    ? pi()*4*4 
    //  50.24 
    -- explicit discard is needed to ignore return 
    {} = pi()