⚡ Operators in iPseudo

Master all operators to perform calculations, comparisons, and logical operations!

🔢 Arithmetic Operators

Perform mathematical calculations:

Operator Operation Example Result
+ Addition 5 + 3 8
- Subtraction 5 - 3 2
* Multiplication 5 * 3 15
/ Division 10 / 4 2.5
mod Modulus (remainder) 10 mod 3 1
^ Exponentiation 2 ^ 3 8
pseudocode
Algorithm ArithmeticOperators

var a = 15
var b = 4

Print "a + b =", a + b        # 19
Print "a - b =", a - b        # 11
Print "a * b =", a * b        # 60
Print "a / b =", a / b        # 3.75
Print "a mod b =", a mod b    # 3
Print "a ^ 2 =", a ^ 2      # 225

Endalgorithm

🔍 Comparison Operators

Operator Meaning Example
== Equal to 5 == 5 → true
!= Not equal to 5 != 3 → true
> Greater than 5 > 3 → true
< Less than 5 < 3 → false
>= Greater or equal 5 >= 5 → true
<= Less or equal 5 <= 3 → false

🧠 Logical Operators

Operator Description Example
and Both conditions true true and true → true
or At least one true true or false → true
not Opposite value not true → false
Algorithm LogicalOperators

var age = 25
var hasLicense = true

var canDrive = age >= 18 and hasLicense
Print "Can drive:", canDrive

Endalgorithm

⚙️ Operator Precedence

Operations are performed in this order (highest to lowest):

  • Parentheses ( )
  • Exponentiation ^
  • Multiplication/Division/Modulus *, /, mod
  • Addition/Subtraction +, -
  • Comparison >, <, ==, etc.
  • Logical not, and, or
Pro Tip: When in doubt, use parentheses to make your intent clear!