LOIS

LANGUAGE OPERATED on IS

LOIS is a simple, human-readable programming language designed to make programming and mathematics explicit and easy to understand.

LOIS is made for beginners. It keeps programming concepts recognizable and follows clear rules instead of hiding everything behind magic.

Basic Syntax

LOIS programs are written as a sequence of statements. Newlines normally separate statements.

name is "Afnan"
age = 15

if age >= 13
then output is "Teenager"

Comments

Single-line comments

note: this line is ignored

output is "Hello"

note: is case-insensitive.

Multi-line comments

[
This entire section
is ignored by LOIS.
]

output is "Hello"

Output

LOIS has two main output forms:

output is ...
output = ...

output is

output is prints something directly or prints a stored value.

output is "Hello World"
output is 12
output is "1 + 2"

The last example prints 1 + 2, rather than calculating it.

output =

output = evaluates an expression before printing it.

output = 1 + 2
output = (10 + 5) * 2

Output:

3
30

Variables

Strings

name is "Viral"
message is "Hello World"

Numbers

x = 8
y = 5

output = x * y

Booleans

ready is True
finished is False

True and False are case-sensitive boolean literals. Lowercase true and false are ordinary words.

is vs =

SyntaxPurpose
name is "Alice"Store text
age = 15Numeric assignment
output is ageDirect output
output = age + 5Evaluate and output

The simple rule:

is → direct/literal-style assignment or output
=  → numeric/expression assignment or evaluation

Decimals and upto

LOIS uses one numeric type: num.

x = 3

output = x / 5 upto 3

Output:

0.600

upto controls the number of decimal places displayed.

Arithmetic

OperatorMeaning
+Addition
-Subtraction
*Multiplication
/Division
%Modulo
^Power
!Factorial
output = 5 + 2
output = 5 - 2
output = 5 * 2
output = 10 / 2
output = 10 % 3
output = 2 ^ 3
output = 5!

Comparisons

>
<
>=
<=
==
!=
x = 10

output is x > 5
output is x == 10
output is x != 5

Comparison results are booleans.

Logical Operators

not

output is not True

and

output is True and False

or

output is True or False

and has higher precedence than or.

Parentheses and Precedence

output = (2 + 3) * 4

Output:

20

Without parentheses:

output = 2 + 3 * 4

Output:

14

Precedence from highest to lowest:

  1. Parentheses
  2. Unary operations
  3. Power
  4. Multiplication, division, modulo
  5. Addition, subtraction
  6. Comparisons
  7. and
  8. or

Negative Numbers

x = -5
output = -x

Mathematical Functions

FunctionPurpose
root(x)Square root
root3(x)Cube root
root4(x)Fourth root
rootn(x)Nth root
sin(x)Sine
cos(x)Cosine
tan(x)Tangent
log(x)Base-10 logarithm
ln(x)Natural logarithm
abs(x)Absolute value
round(x)Nearest integer
floor(x)Round down
ceil(x)Round up
output = root(25)
output = root3(27)
output = abs(-25)
output = round(3.6)
output = floor(3.9)
output = ceil(3.1)

The pi Constant

output = pi
output = sin(pi / 2)

pi is a built-in numeric constant.

Factorial

output = 5!
output = (3 + 2)!
output = 5! + 3!

Factorial requires a non-negative whole number.

Sets

numbers is {10, 20, 30}

output is numbers

Elements are separated by commas.

Set indexing

LOIS uses 1-based indexing.

numbers is {10, 20, 30}

output is numbers1
output is numbers2
output is numbers3

Output:

10
20
30

Input

String input

input is name
output is name

input is expects text.

Numeric input

input = age
output = age * 2

input = expects a number.

If / Then / Else

age = 18

if age >= 18
then output is "Adult"

then is required.

Else

age = 15

if age >= 18
then output is "Adult"
else output is "Not adult"

But If

but if works like an else-if.

score = 75

if score >= 90
then output is "A"
but if score >= 80
then output is "B"
but if score >= 70
then output is "C"
else output is "Below C"

While Loops

x = 0

while x < 5
then x = x + 1
then output is x

The loop continues while its condition is true.

For Loops

for x <= 5
then output is x

The loop variable starts at 1 and automatically increases by 1.

Repeat

repeat 5
then output is "Hello"

The statement executes five times.

Stop

stop

stop immediately stops the current loop.

Skip

skip

skip skips the current iteration and continues with the next one.

StatementEquivalent idea
stopbreak
skipcontinue

Functions

The primary function syntax is:

square is function of x * x

This creates a function named square with parameter x.

Calling functions

Function calls always use parentheses.

square is function of x * x

output = square(5)

Output:

25

Multiple parameters

add is function of x + y

output = add(3, 6)

Output:

9

Functions in expressions

square is function of x * x

output = square(5) + 10

Output:

35

String functions

greet is function of "hello " + name

name is "Alice"

output is greet(name)

Alternative function syntax

function is square is of x * x

function square is of x * x

The recommended form remains:

square is function of x * x

Returns

Functions can explicitly describe their result using returns.

square function x it returns x * x

The expression after returns is the function result.

Typecasting

LOIS supports num and string type conversion.

age = 15
age is string

And:

age is num

Case Sensitivity

Many language keywords are case-insensitive.

and
AND
And

These represent the same logical operator.

Boolean literals are deliberately different:

True
False

Lowercase true and false are ordinary words.

Nesting and then

LOIS does not use indentation to determine nesting.

if x > 5
then output is "Large"

Nested structures use then:

while x < 10
then if x == 5
then stop

Reserved Words

is
num
string
function
of
if
then
else
but
while
for
repeat
return
returns
output
input
and
or
not
True
False
stop
skip

If you want to print one literally, use quotes:

output is "if"

Operators

Arithmetic:
+ - * / % ^ !

Comparison:
> < >= <= == !=

Assignment:
=

Logical:
and or not

Grouping:
( )

Absolute value:
| |

Common Errors

Undefined variable

output is unknown

An undefined variable causes an error.

Invalid numeric assignment

x = "hello"

= expects a numeric expression.

Missing then

if x > 5
output is "yes"

Correct:

if x > 5
then output is "yes"

Invalid function call

square 5

Correct:

square(5)

Complete Example

name is "Alice"
age = 15

square is function of x * x

if age >= 13
then output is "Teenager"

output is name
output = square(5)

The Core Idea

The most important distinction in LOIS is is versus =.

name is "Alice"

stores text.

age = 15

stores a number.

output is name

prints a value directly.

output = age + 5

evaluates an expression and prints the result.

Functions follow the same readable structure:

square is function of x * x

square(5)

And control structures use then rather than indentation.

LOIS: simple syntax, explicit rules, real programming.