INCLAN: eval: Difference between revisions

From CYANA Wiki
Jump to navigation Jump to search
(Created page with 'Usage: eval ''variable'' = ''expression'' show ''variable'' ... set ''variable'' ... set ''variable'' = ''value'' unset ''variable'' ... ''vari…')
 
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Usage: eval ''variable'' = ''expression''
== Synopsis ==
      show ''variable'' ...
      set ''variable'' ...
      set ''variable'' = ''value''
      unset ''variable'' ...
      ''variable'' = ''expression''
      ''variable'' := ''expression''
      external ''variable'' = ''expression''
      external ''variable'' := ''expression''


The "eval" statement evaluates the Fortran-77 ''expression'' and assigns the
'''eval'''  ''variable'''''='''''expression''
result to the ''variable''.


The statement "show" without parameters lists the names and values of all
''variable'''''='''''expression''
global variables that do not have the value "NULL"; with parameters, "show"
lists the names and values of the given variables. Global variables that are
hidden by a local variable with the same name are identified by the attribute
"hidden".


The statement "set" without parameters lists the names and values of all
== Description ==
variables that do not have the value "NULL"; with parameters, "set" lists
the names and values of the given variables. In contrast to "show", local
variables are listed too.


"set ''variable'' = ''value''" gives the variable ''variable'' the string value
Evaluates the arithmetic or string ''expression'' according to the rules of FORTRAN-77 and assigns the result to the ''variable''. The keyword '''eval''' can be omitted. FORTRAN-77 function names must be given in lowercase letters.
''value''.


The statement "unset" the given variables. System variables cannot be unset.
== Examples ==


"''variable'' = ''expression''" and "''variable'' := ''expression''" are shorthand
eval i = 7
notations for "eval ''variable'' = ''expression''" and "set ''variable'' =
sentence = ’A flexible program!’
''expression''", respectively.
j = mod(i,4)**2
 
l = len(sentence)
"external ''variable'' := ''value''" or "external ''variable'' = ''value''" assign
show i sentence j l
a value (i. e. a string) or the result of an expression to an external
... Variables:
(non-local) variable even if a local variable with the same name exists.
    i        = 7
This command can be used to return values from a macro to the calling macro.
    sentence = ’A flexible program!’
    j        = 9
    l        = 19

Latest revision as of 15:42, 13 August 2009

Synopsis

eval variable=expression

variable=expression

Description

Evaluates the arithmetic or string expression according to the rules of FORTRAN-77 and assigns the result to the variable. The keyword eval can be omitted. FORTRAN-77 function names must be given in lowercase letters.

Examples

eval i = 7
sentence = ’A flexible program!’
j = mod(i,4)**2
l = len(sentence)
show i sentence j l
... Variables:
    i        = 7
    sentence = ’A flexible program!’
    j        = 9
    l        = 19