Difference between revisions of "Summary of Programming Constructs"

m
m
Line 1: Line 1:
 
[[Category: Analytica User Guide]]
 
[[Category: Analytica User Guide]]
<breadcrumbs> Analytica User Guide > {{PAGENAME}}</breadcrumbs><br />
+
<breadcrumbs> Analytica User Guide > Procedural Programming > {{PAGENAME}}</breadcrumbs><br />
  
 
Please see the table below for a list of Analytica programming constructs, their meanings, and links to references with more details, if available.
 
Please see the table below for a list of Analytica programming constructs, their meanings, and links to references with more details, if available.

Revision as of 03:32, 29 December 2015


Please see the table below for a list of Analytica programming constructs, their meanings, and links to references with more details, if available.

Construct Meaning: For more, see
e1; e2; … ei Semicolons join a group of expressions to be evaluated in sequence Begin-End for Grouping Expressions
BEGIN e1; e2; …

ei END

A group of expressions to be evaluated in sequence Begin-End for Grouping Expressions
(e1; e2; … ei) Another way to group expressions Begin-End for Grouping Expressions
m .. n Generates a list of successive integers from m to n Functions Expecting Atomic Parameters
Var x := e Define local variable x and assign initial value e Defining a Local Variable
Index i := e Define local index i and assign initial value e Local Indexes
x := e Assigns value from evaluating e to local variable x.

Returns value e.

Assigning to a Local Variable
While Test Do Body While Test is True, evaluate Body and repeat.

Returns last value of Body.

While(Test) Do Body
{ comments }

/* comments */

Curly brackets { } and /* */ are alternative ways to enclose comments to be ignored by the parser. Procedural Programming Example
'text'

"text"

You can use single or double quotes to enclose a literal text value, but they must match. Text Values
For x := a DO e Assigns to loop variable x, successive atoms from array a and repeats evaluation expression e for each value of x.

Returns an array of values of e with the same indexes as a.

For i := a Do expr
For x[i, j…] := a DO e Same, but it assigns to x successive sub-arrays of a, each indexed by the indices, [i, j … For i := a Do expr
\ e Creates a reference to the value of expression e. References and Data Structures
\ [i, j …] e Creates an array indexed by any indexes of e other than i, j … of references to sub-arrays of e each indexed by i, j …. References and Data Structures
# r Returns the value referred to by reference r. References and Data Structures


Comments


You are not allowed to post comments.