Difference between revisions of "Assignment"

From Mesham
Jump to navigationJump to search
(Created page with '==Syntax== In order to assign a value to a variable then the programmer will need to use variable assignment. [lvalue]:=[rvalue]; Where ''lvalue'' is a variable and ''rvalue''…')
 
(Examples)
Line 13: Line 13:
 
== Examples==
 
== Examples==
  
var i:=4;<br>
+
var i:=4;
var j:=i;
+
var j:=i;
 +
 
 +
In this example the variable ''i'' will be declared and set to value 4, and the variable ''j'' also declared and set to the value of ''i'' (4.) Via type inference the types of both variables will be that of ''Int''
  
 
[[Category:sequential]]
 
[[Category:sequential]]

Revision as of 15:56, 31 December 2009

Syntax

In order to assign a value to a variable then the programmer will need to use variable assignment.

[lvalue]:=[rvalue];

Where lvalue is a variable and rvalue a variable or expression

Semantics

Will assign a value to a variable

Examples

var i:=4;
var j:=i;

In this example the variable i will be declared and set to value 4, and the variable j also declared and set to the value of i (4.) Via type inference the types of both variables will be that of Int