Recent Changes - Search:

* PCAN

* Phix

edit SideBar

Functions

Index | Core Language | Declarations | Functions

Functions

These are just like procedures, but they return a value, and can be used in an expression, e.g.

    function average(atom a, atom b)
        return (a+b)/2
    end function

Any Phix object can be returned. You can return multiple values, by returning a sequence of objects. e.g.

     return {x_pos, y_pos}

See also: Multiple Assignment

The general term "subroutine", or simply "routine" is used when a remark is applicable to both procedures and functions.

Nested routines are not currently permitted, but some groundwork has been started, see demo\rosetta\Nested_function.exw

< Procedures | Index | Types >

Edit - History - Print - Recent Changes - Search
Page last modified on April 19, 2026, at 02:57 AM