Skip to content
Kavachकवच

Output: print

● Beginner2 min

Each print call writes exactly one line to standard output.

fn main() {
    print("Hello")
    print(42)
    print([1, 2, 3])
    print("one line")
    print("another line")
}

The program ran and printed:

kavach run print.kav

Hello42[1, 2, 3]one lineanother line
print.kav: Kavach code, then what running it prints

Printing needs the Console capability. main has it, and for your own functions the compiler works it out, so a beginner never notices. A pub function, one other files may call, must say it with uses Console: its first line then tells every caller that it writes to the screen.