Important Notice:

Assignment Operators

Assignment Operators

41 views 1 min read

असाइनमेंट ऑपरेटर (Assignment Operators) :-

वेरिएबल में मान असाइन करना या ऑपरेशन करके असाइन करना।

Example:-

 let x = 5;        // simple assignment
x += 2;           // x = x + 2 → 7
x -= 1;           // x = x - 1 → 6
x *= 3;           // x = x * 3 → 18
x /= 2;           // x = x / 2 → 9
x %= 4;           // x = x % 4 → 1
x **= 2;          // x = x ** 2 → 1

4. Assignment Operators
Assign values to variables, or perform an operation and assign.

Example:

text

let x = 5; // simple assignment x += 2; // x = x + 2 → 7 x -= 1; // x = x - 1 → 6 x *= 3; // x = x * 3 → 18 x /= 2; // x = x / 2 → 9 x %= 4; // x = x % 4 → 1 x **= 2; // x = x ** 2 → 1

Related Notes