3

Operators

Arithmetic, comparison, and logical operations

Arithmetic Operators

Operator Name Example Result
+ Addition 10 + 5 15
- Subtraction 10 - 5 5
* Multiplication 10 * 5 50
/ Division 10 / 4 2.5
% Modulo 10 % 3 1
Math Operations
ayanmo a = 20;
ayanmo b = 7;

Irosu.fo("Sum: " + (a + b));        // 27
Irosu.fo("Difference: " + (a - b)); // 13
Irosu.fo("Product: " + (a * b));    // 140
Irosu.fo("Quotient: " + (a / b));   // 2.857...
Irosu.fo("Remainder: " + (a % b));  // 6
let a = 20;
let b = 7;

Fmt.println("Sum: " + (a + b));        // 27
Fmt.println("Difference: " + (a - b)); // 13
Fmt.println("Product: " + (a * b));    // 140
Fmt.println("Quotient: " + (a / b));   // 2.857...
Fmt.println("Remainder: " + (a % b));  // 6

Comparison Operators

Operator Name Example Result
== Equal 5 == 5 otito
!= Not Equal 5 != 3 otito
< Less Than 3 < 5 otito
> Greater Than 5 > 3 otito
<= Less or Equal 5 <= 5 otito
>= Greater or Equal 5 >= 3 otito
Comparisons
ayanmo age = 18;

Irosu.fo(age == 18);  // otito (true)
Irosu.fo(age >= 21);  // iro (false)
Irosu.fo(age < 100);  // otito (true)
let age = 18;

Fmt.println(age == 18);  // true
Fmt.println(age >= 21);  // false
Fmt.println(age < 100);  // true

Logical Operators

Operator Name Example Result
&& AND otito && iro iro
|| OR otito || iro otito
! NOT !otito iro
Logic
ayanmo logged_in = otito;
ayanmo is_admin = iro;

// Both must be true
ti (logged_in && is_admin) {
    Irosu.fo("Admin access granted");
}

// Either can be true
ti (logged_in || is_admin) {
    Irosu.fo("Some access granted");
}

// Negation
ti (!is_admin) {
    Irosu.fo("Not an admin");
}
let logged_in = true;
let is_admin = false;

// Both must be true
if (logged_in && is_admin) {
    Fmt.println("Admin access granted");
}

// Either can be true
if (logged_in || is_admin) {
    Fmt.println("Some access granted");
}

// Negation
if (!is_admin) {
    Fmt.println("Not an admin");
}

String Concatenation

Concatenation
ayanmo first = "Ifá";
ayanmo last = "Lang";
ayanmo full = first + "-" + last;
Irosu.fo(full);  // "Ifá-Lang"

// Numbers auto-convert in concatenation
ayanmo version = 1.2;
Irosu.fo("Version: " + version);  // "Version: 1.2"
let first = "Ifá";
let last = "Lang";
let full = first + "-" + last;
Fmt.println(full);  // "Ifá-Lang"

// Numbers auto-convert in concatenation
let version = 1.2;
Fmt.println("Version: " + version);  // "Version: 1.2"

What You Learned