INCLAN: eval: Difference between revisions

From CYANA Wiki
Jump to navigation Jump to search
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Synopsis ==
== Synopsis ==


'''eval  variable=expression'''
'''eval''' ''variable'''''='''''expression''


'''variable=expression'''
''variable'''''='''''expression''


== Description ==


eval ''variable'' = ''expression''
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.
      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
== Examples ==
result to the ''variable''.


The statement "show" without parameters lists the names and values of all
eval i = 7
global variables that do not have the value "NULL"; with parameters, "show"
sentence = ’A flexible program!’
lists the names and values of the given variables. Global variables that are
j = mod(i,4)**2
hidden by a local variable with the same name are identified by the attribute
l = len(sentence)
"hidden".
show i sentence j l
 
... Variables:
The statement "set" without parameters lists the names and values of all
    i        = 7
variables that do not have the value "NULL"; with parameters, "set" lists
    sentence = ’A flexible program!’
the names and values of the given variables. In contrast to "show", local
    j        = 9
variables are listed too.
    l        = 19
 
"set ''variable'' = ''value''" gives the variable ''variable'' the string value
''value''.
 
The statement "unset" the given variables. System variables cannot be unset.
 
"''variable'' = ''expression''" and "''variable'' := ''expression''" are shorthand
notations for "eval ''variable'' = ''expression''" and "set ''variable'' =
''expression''", respectively.
 
"external ''variable'' := ''value''" or "external ''variable'' = ''value''" assign
a value (i. e. a string) or the result of an expression to an external
(non-local) variable even if a local variable with the same name exists.
This command can be used to return values from a macro to the calling macro.

Latest revision as of 14: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