Goto main content

use

Copy a variable from a parent function or a parent parser.

USE

NAME

use - Copies a variable from a parent function or a parent parser.

SYNOPSIS

use id;

DESCRIPTION

This function is used to make a copy of a variable from a caller's function or from a precedent parser.

For example, if one uses generate, a variable defined in the parent can be used in the template.

It can be used recursively to try to find a variable.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

res={_{
        a = 5;

        function a1()
            a2();
        endf

        function a0()
            use a;
            "a1="; a;
            a2();
        endf

        function a2()
            use a;

            "a2="; a;
        endf

        function a3()
            "a3="; a;
            a2();
        endf


        a1();
        a0();
        a3();
}} will return res=a2=5a1=5a2=5a3=a2=5.

SEE ALSO

AUTHOR

Written by Pierre Laplante and Caroline Laplante

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2021 extenso Inc. All rights reserved.