Assignment
Operators | Name |
---|---|
= | Divide equals |
+= | Plus equals |
-= | Minus equals |
*= | Multiply equals |
\= | Divide equals |
~= | Bitwise NOT equals |
int assignment examples
# Declare "x"
int x;
# Declare and initialize "x"
int x = 5;
int temp = -25;
long assignment examples
# Declare "l"
long l;
# Declare and initialize "l"
long l = 5;
long temp = -25;
double assignment examples
# Declare "d"
double d;
# Declare and initialize "d"
int d = 5.0;
int temp = -25.0;
string assignment examples
# Declare "s"
string s;
# Declare and initialize "s"
string s = "Hello, world!";
string temp = "\",Hello,\nworld!\"";
Complex assignment examples
int a = 25;
int b = 1033;
int c = (a * b) + 56 / 2;
int d = (2 + (c - 1000)) - 9;