Assignment: =, :=

The assignment operator is used to assign a value to a variable. it can be used for any data type with the only condition that the first parameter (left side) must be a value receiver, for example a variable. depending on the programming language can be different terms for the assignment of values to the variables, for example depending on the type.

=

Description

var =expression;
Used keywords: =

Input


Output

Compatible programing languages:
C | Visual C++ .NET | C++ | C# | Java | JavaScript | PHP

Examples

Example

Assignment the possible of use:
x = 1.234;         // x = 1.234
y = x * 3.14;      // y = 3.87476
if (y<5)
   y = y/ 3.14;    // y = 1.234

Example

Other pieces of example codes:
ret = j<i;
a2 = !true;
z = (x+y+30)+3;
i = i-5;
y = x / 0.5;
x =0;

:=

Description

var :=expression;
Used keywords: :=

Input

Compatible programing languages:
Pascal | Object Pascal | Free Pascal

Examples

Object Pascal

Assignment the possible of use:
x := 1.234;         // x = 1.234
y := x * 3.14;      // y = 3.87476
if y<5 then
   y := y/ 3.14;    // y = 1.234

Object Pascal

Other pieces of example codes:
if x>$abc then
  y := x / $a;    // y = 466
a := 4 >= 2;
i:=10;
z := (x+y+30)+3;
z := (x * 2 div y +5);
y:= false;

=

Description

var =expression
Used keywords: =

Input

Compatible programing languages:
Basic | FreeBASIC | Visual Basic .NET

Examples

Basic

Assignment the possible of use:
x = 1.234         ' x = 1.234
y = x * 3.14      ' y = 3.87476
if y<5 then
   y = y/ 3.14    ' y = 1.234
end if

Basic

Other pieces of example codes:
do
  i=i+1
  if i=5 then
    exit do
end if
loop while i <10
do
  i=i+1
  if i=3 then
    exit do
end if
loop until (i=10)
z = (x-y)-30.5
z = (x * 2 / y +5)
z = x xor 123
a = 4 >= 2
Languages: en hu cz sk