← Back to Documentation Hub

Writing Core Logic

Welcome to KopiLang! If you already know Python, KopiLang will feel very familiar. It combines the clean, lightweight layout of Python with the robust, static typing systems of Java.

Printing Text

Just like Python print() function, KopiLang uses a simple line by line command interface. You dont need to wrap your statements in complex setup wrappers or terminate lines with semicolons.

println("Hello World!")

Variables and Loops

While Python guesses your variable types automatically at runtime, KopiLang uses Java's strict compilation rules. You gain type safety while keeping a clean syntax:

# Explicit static typing with no semicolons
String name = "Kopi"
int standardInteger = 24

# Standard Java loops
for (int i = 1; i <= 5; i++) {
    println("Count: " + i)
}

Methods

You will declare a variables return type using -> arrows. Not specifying the return type it means void

Void:

pub myMethod() {} # This is void

Return:

pub myMethod() -> int { # This return int
    return 0
}

To make it static simply put stc in front of pub
pub stc myMethod() {}