Skip to content
Kavachकवच

Syntax

● Beginner4 minBefore this: Your First ProgramSpec 1.1

How a Kavach file is written: one statement per line, blocks in braces, no semicolons.

fn main() {
    greet("Asha")
    greet("Ravi")
}

fn greet(name: String) {
    print("Hello, {name}")
}

The program ran and printed:

kavach run main.kav

Hello, AshaHello, Ravi
main.kav: Kavach code, then what running it prints

The rules in short

  • A file ends in .kav. A program starts at fn main().
  • One statement per line. There are no semicolons.
  • Braces { } group lines into a block: the body of a function, a loop or an if.
  • Text goes in double quotes; a single character in single quotes.
  • Indent with four spaces. kavach fmt does it for you.

Kavach is case-sensitive: total and Total are two different names.

One page for each form