Lipi

Basic Expressions

Expressions in Lipi are combinations of values, variables, operators, and function calls that evaluate to a value.

Syntax

term { (`+` | `-` | `*` | `/` ) term }

Arithmetic Operations

Lipi supports the following arithmetic operations:

  • + - Addition
  • - - Subtraction
  • * - Multiplication
  • / - Division
purna a;
purna b;
purna result;

a = 10;
b = 5;

result = a + b;  :) Addition: result = 15
bhana(result);

result = a - b;  :) Subtraction: result = 5
bhana(result);

result = a * b;  :) Multiplication: result = 50
bhana(result);

result = a / b;  :) Division: result = 2
bhana(result);

Complex Expressions

You can combine multiple operations in a single expression. Lipi follows the standard order of operations (PEMDAS):

  1. Parentheses
  2. Exponents (not supported in Lipi)
  3. Multiplication and Division (from left to right)
  4. Addition and Subtraction (from left to right)
purna a;
purna b;
purna c;
purna result;

a = 5;
b = 3;
c = 2;

result = a + b * c;  :) result = 5 + (3 * 2) = 11
bhana(result);

result = (a + b) * c;  :) result = (5 + 3) * 2 = 16
bhana(result);

String Expressions

You can concatenate strings using the + operator:

paath firstName;
paath lastName;
paath fullName;

firstName = "John";
lastName = "Doe";

fullName = firstName + " " + lastName;  :) Concatenation: fullName = "John Doe"
bhana(fullName);

Next Steps

Now that you understand basic expressions in Lipi, you can learn more about: