Please enable JavaScript to view this site.

A-Shell Reference

Written July 2023

By default, parameters are passed to functions and SBX subroutines "by value", meaning that the value of the source (calling) parameter is passed to the variable within the target function or subroutine. This is essentially equivalent to an assignment statement, with automatic type conversions taking place as necessary. In order for an updated value to be passed back, the function or subroutine must explicitly use an XPUTARG statement to perform the reverse assignment—i.e., to copy the updated value back to the calling parameter (again, with type conversions as needed). Note that parameter passing by value can be limited to one direction by adding the inputonly or outputonly (User-Defined Functions) modifiers on the function parameter declaration.

Example

map1 brownbag, ST_LUNCH

    ...

    call Fn'School(brownbag)

    ...

 

Function Fn'School(lunch as ST_LUNCH)

    ...

   xputarg @lunch

EndFunction

 

In the above example, the local variable lunch receives a copy of the value of the variable brownbag. Any changes to the the lunch variable within the function have no effect on the brownbag variable until the (optional) xputarg @lunch statement copies the updated value back.