Skip to main content

First Program

Your first Kexra program demonstrates basic output and arithmetic, introducing core concepts like statements and expressions.

Why this exists

A first program provides immediate feedback and builds confidence in using the language, showing how to write and execute code.

How it works

Programs are text files with .kx extension containing statements. The say statement outputs values, and expressions combine values with operators.

Examples

# First program: hello.kx
say "Hello, Kexra!"

# With arithmetic
say 2 + 3
say "The answer is " + (10 * 2)

Common mistakes

  • Forgetting the .kx extension
  • Using invalid syntax (e.g., missing quotes for strings)
  • Not saving the file before running