Program Structure
A program in Lipi is a sequence of statements, each ending with a semicolon ;.
statement1;
statement2;
statement3;Basic Structure
Every Lipi program consists of a series of statements. Each statement must end with a semicolon, which tells the compiler that the statement is complete. Unlike many other languages, Lipi doesn't require a main function - you can write code directly at the top level.
Statements can be:
- Variable declarations
- Assignment statements
- Function calls
- Control flow statements (if, while, for)
- Function definitions
- Return statements
Complete Program Example
Here's an example of a complete Lipi program that calculates the sum of two numbers:
(: A simple program to calculate the sum of two numbers :)
purna a;
purna b;
purna sum;
bhana("Enter first number: ");
suna(a);
bhana("Enter second number: ");
suna(b);
sum = a + b;
bhana("The sum is: ");
bhana(sum);Next Steps
Now that you understand the basic structure of a Lipi program, you can learn more about: