Difference between revisions of "Summary of Programming Constructs"

m
(Local Variables --> Local Values (terminology change))
 
(10 intermediate revisions by 2 users not shown)
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.
  
{| class="wikitable"
+
:{| class="wikitable"
 
! '''Construct'''
 
! '''Construct'''
! '''Meaning:'''
+
! '''Meaning'''
 
! '''For more, see'''
 
! '''For more, see'''
 
|-
 
|-
| <code>e1; e2; … ei</code>
+
| <code>''e1''''';''' ''e2''''';''' ''ei''</code>
 
| Semicolons join a group of expressions to be evaluated in sequence
 
| Semicolons join a group of expressions to be evaluated in sequence
|[http://wiki.analytica.com/index.php?title=Begin-End_for_Grouping_Expressions Begin-End for Grouping Expressions]
+
|[[Begin-End for Grouping Expressions]]
 
|-
 
|-
| <code>BEGIN e1; e2; …</code>
+
| <code>'''BEGIN''' ''e1''''';''' ''e2''''';''' …</code>
<code>ei END</code>
+
<code>''ei'' '''END'''</code>
 
| A group of expressions to be evaluated in sequence
 
| A group of expressions to be evaluated in sequence
|[http://wiki.analytica.com/index.php?title=Begin-End_for_Grouping_Expressions Begin-End for Grouping Expressions]
+
|[[Begin-End for Grouping Expressions]]
 
|-
 
|-
| <code>(e1; e2; … ei)</code>
+
| <code>'''('''''e1''''';''' ''e2''''';''' ''ei''''')'''</code>
 
| Another way to group expressions
 
| Another way to group expressions
|[http://wiki.analytica.com/index.php?title=Begin-End_for_Grouping_Expressions Begin-End for Grouping Expressions]
+
|[[Begin-End for Grouping Expressions]]
 
|-
 
|-
| <code>m .. n</code>
+
| <code>''m'''''..'''''n''</code>
| Generates a list of successive integers from <code>m</code> to <code>n</code>
+
| Generates a list of successive integers from «m» to «n»
|[http://wiki.analytica.com/index.php?title=Ensuring_Array_Abstraction#Functions_Expecting_Atomic_Parameters Functions Expecting Atomic Parameters]
+
|[[Ensuring_Array_Abstraction#Functions_Expecting_Atomic_Parameters|Functions Expecting Atomic Parameters]]
 
|-
 
|-
| <code>Var x := e</code>
+
| <code>'''Var''' ''x'' ''':=''' ''e''</code>
| Define local variable <code>x</code> and assign initial value <code>e</code>
+
| Define local identifier «x» to refer to the value that results from evaluating «e»
|[http://wiki.analytica.com/index.php?title=Local_Variables#Defining_a_local_variable Defining a Local Variable]
+
|[[Local_Values#Defining_a_local_value|Defining a Local Value]]
 
|-
 
|-
| <code>Index i := e</code>
+
| <code>'''Index''' ''i'' ''':=''' ''e''</code>
| Define local index <code>i</code> and assign initial value <code>e</code>
+
| Define local index «i» and assign initial value «e»
|[http://wiki.analytica.com/index.php?title=Local_Indexes Local Indexes]
+
|[[Local Indexes]]
 
|-
 
|-
|<code>x := e</code>
+
|<code>''x'' ''':=''' ''e''</code>
| Assigns value from evaluating <code>e</code> to local variable <code>x</code>.
+
| Assigns the result from evaluating «e» to local value «x».
Returns value <code>e</code>.
+
Returns value «e».
|[http://wiki.analytica.com/index.php?title=Local_Variables#Assigning_to_a_local_variable: Assigning to a Local Variable]
+
|[[Local_Values#Assigning_to_a_local_value:|Assigning to a Local Value]]
 
|-
 
|-
| <code>While Test </code><code>Do Body</code>
+
| <code>'''While''' ''Test'' </code><code>'''Do''' ''Body''</code>
| While <code>Test</code> is True, evaluate <code>Body</code> and repeat.  
+
| While «Test» is <code>True</code>, evaluate «Body» and repeat.  
Returns last value of <code>Body</code>.
+
Returns last value of «Body».
|[http://wiki.analytica.com/index.php?title=For_and_While_Loops#While.28Test.29_Do_Body While(Test) Do Body]
+
|[[For_and_While_Loops#While.28Test.29_Do_Body|While(Test) Do Body]]
 
|-
 
|-
| { comments }
+
| <code>'''{''' ''comments'' '''}'''</code>
/* comments */
+
<code>'''/*''' ''comments'' '''*/'''</code>
| Curly brackets { } and /* */ are alternative ways to enclose comments to be ignored by the parser.
+
| Curly brackets { } and /* */ are alternative ways to enclose «comments» to be ignored by the parser.
|[http://wiki.analytica.com/index.php?title=Procedural_Programming_Example Procedural Programming Example]
+
|[[Procedural Programming Example]]
 
|-
 
|-
| 'text'
+
| <code>'' 'text' '''</code>
"text"
+
<code>'''"'''''text'''''"'''</code>
| You can use single or double quotes to enclose a literal text value, but they must match.
+
| You can use single or double quotes to enclose a literal «text» value, but they must match.
|[http://wiki.analytica.com/index.php?title=Text_values Text Values]
+
|[[Text values]]
 
|-
 
|-
| <code>For x := a DO e</code>
+
| <code>'''For''' ''x'' := ''a'' '''Do''' ''e''</code>
| Assigns to loop variable <code>x</code>, successive atoms from array <code>a</code> and repeats evaluation expression <code>e</code> for each value of <code>x</code>.
+
| 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 <code>e</code> with the same indexes as <code>a</code>.
+
Returns an array of values of «e» with the same indexes as «a».
|[http://wiki.analytica.com/index.php?title=For_and_While_Loops#For_i_:.3D_a_Do_expr For i := a Do expr]
+
|[[For_and_While_Loops#For_i_:.3D_a_Do_expr|For i := a Do expr]]
 
|-
 
|-
| <code>For x[i, j…] := a DO e</code>
+
| <code>'''For''' ''x[i, j…]'' := ''a'' '''Do''' ''e''</code>
| Same, but it assigns to x successive sub-arrays of <code>a</code>, each indexed by the indices, <code>[i, j </code>
+
| Same, but it assigns to «x» successive sub-arrays of «a», each indexed by the indices, [«i», «j» ]
|[http://wiki.analytica.com/index.php?title=For_and_While_Loops#For_i_:.3D_a_Do_expr For i := a Do expr]
+
|[[For_and_While_Loops#For_i_:.3D_a_Do_expr|For i := a Do expr]]
 
|-
 
|-
| <code>\ e</code>
+
| <code>'''\'''''e''</code>
| Creates a reference to the value of expression <code>e</code>.
+
| Creates a reference to the value of expression «e».
|[http://wiki.analytica.com/index.php?title=References_and_Data_Structures References and Data Structures]
+
|[[References and Data Structures]]
 
|-
 
|-
| <code>\ [i, j …] e</code>
+
| <code>'''\'''''[i, j …]e''</code>
| Creates an array indexed by any indexes of <code>e</code> other than <code>i, j </code> of references to sub-arrays of e each indexed by <code>i, j ….</code>
+
| 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» ….
|[http://wiki.analytica.com/index.php?title=References_and_Data_Structures References and Data Structures]
+
|[[References and Data Structures]]
 
|-
 
|-
| <code># r</code>
+
| <code>'''#'''''r''</code>
| Returns the value referred to by reference <code>r</code>.
+
| Returns the value referred to by reference «r».
|[http://wiki.analytica.com/index.php?title=References_and_Data_Structures References and Data Structures]
+
|[[References and Data Structures]]
 
|}
 
|}
  
 +
==See Also==
 +
* [[Expression Assist]]
 +
* [[Expression Syntax]]
 +
* [[Using References]]
 +
* [[Function calls and parameters]]
 +
* [[User-Defined Functions]]
 +
* [[Evaluate]]
  
  
 
<footer>Procedural Programming Example / {{PAGENAME}} / Begin-End for Grouping Expressions</footer>
 
<footer>Procedural Programming Example / {{PAGENAME}} / Begin-End for Grouping Expressions</footer>

Latest revision as of 00:17, 5 January 2017


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 identifier «x» to refer to the value that results from evaluating «e» Defining a Local Value
Index i := e Define local index «i» and assign initial value «e» Local Indexes
x := e Assigns the result from evaluating «e» to local value «x».

Returns value «e».

Assigning to a Local Value
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

See Also


Comments


You are not allowed to post comments.