We earn commissions when you shop through the links below.
Om Lang is a general-purpose programming language.
It’s not only for websites, AI, apps, or servers—you can use it to build any type of software. It’s designed so that you can learn programming easily. Om Lang is very simple, very fast, and includes all the latest modern features found in today’s programming languages.
OM Lang is a statically typed language like C, C++, Rust, and Go, which makes it a safe programming language. JavaScript, PHP, and Python are not type-safe, which is why OM Lang is better than them. You can think of OM Lang as a better version of C because it gives you C’s speed and power but is simpler to learn and use, and it also teaches you to write proper code.
Installation
OM Lang has two versions: one for PC and one for smartphones.
You can download the OM Lang Android app from the home page or from the Google Play Store.
To install OM Lang on a PC, go to the home page and download the PC version. Inside the downloaded file, you’ll find four folders: Mac, Linux, Windows, and an examples folder.
Data Types
int // 32-bit int, -2,147,483,648 to 2,147,483,647
i16 // 16-bit int, -32,768 to 32,767
i64 // 64-bit int
i8 // 8-bit int, -128 to 127
f32 // 32-bit floating-point number
f64 // 64-bit floating-point number
string
u16 // 16-bit unsigned int, 0 to 65,535
u32 // 32-bit unsigned int, 0 to 4,294,967,295
u64 // 64-bit unsigned int
byte // 8-bit
bool // true / false
array // [1, 2, 3, 4]
map // {'one': 1, 'two': 2}
Variable
A variable is simply a name used to store a value of a specific data type.
By default, variable values cannot be changed. To allow modification, you must declare it using the bdl (Badal) keyword.
Variables can be declared only inside a code block, and their scope remains limited to that block.
do_sau := 200
bdl naam := 'mayank'
naam = 'mayank kumar'
Constant
A constant is also a name used to store a value, but its value cannot be changed.
Constants are declared outside any code block and can be accessed from any code block.
const(
pi = 3.14
gravity = 9.8
)
Structures
A structure is a composite data type that groups variables of different types.
It is basically used to create objects and is used in OOP.
Use the struct keyword to declare a structure.
struct Gaadi {
tyre int
seat int
color string
name string
}
Inside a structure, all variables are non-modifiable by default. To make a field modifiable, place it under the bdl section:
struct Gaadi {
tyre int
seat int
naam string
bdl:
color string
}
Creating and modifying a structure:
bdl car := Gaadi{
tyre : 4
seat : 5
naam : 'Wagon R'
color : 'white'
}
car.color = 'red'
car.tyre = 3 // error
Interface
An interface defines abstract properties—like data types or functions.
Any data type that implements these properties becomes of that interface type.
interface Polygon {
sides int
area() int
}
Enum
An enum is a type containing a list of names that have no values.
Use enums when you need to store a list of items that don’t require values.
enum Phone {
apple
samsung
oneplus
xiaomi
vivo
oppo
}
Function
A function takes some inputs and returns one or more values.
In Om Lang, functions can return multiple values.
fnc area(width int, height int) int {
vaapis width * height
}
fnc circle(radius int) (float, int) {
area := 3.14 * radius * radius
diameter := 2 * radius
vaapis area, diameter
}
area(10, 20)
circle(5)
Method
A method is similar to a function but is defined for a structure.
struct Gaadi {
tyre int
seat int
naam string
bdl:
color string
}
fnc (g Gaadi) color_badlo(color string) {
g.color = color
}
bdl car := Gaadi{
tyre : 4
seat : 5
naam : 'Wagon R'
color : 'white'
}
car.color_badlo('black')
Conditional
color := 'red'
agar color == 'red' {
println('color is red')
} ya agar color == 'blue' {
println('color is blue')
} verna {
println('color is different')
}
Loop
loop i := 0; i < 10; i++ ke liye {
println(i)
}
phal_list := ['apple', 'pomegranate', 'banana', 'coconut', 'grapes']
loop phal_list me ek_phal ke liye {
println(ek_phal)
}
Match
mithai := 'laddoo'
match mithai {
'petha' { println('The sweet is petha') }
'laddoo' { println('The sweet is laddoo') }
'barfi' { println('The sweet is barfi') }
verna { println('Sweet not matched') }
}
₹ Symbol
The ₹ symbol automatically inserts a variable’s value inside a string.
naam := 'mayank'
intro := 'mera naam ₹naam hai'
// output: mera naam mayank hai