Skip to content

1. Hello world

Prerequisite: follow Install, build, and run.

Create a file

Create hello.incn:

def main() -> None:
    println("Hello, Incan!")

Coming from Python?

In Python you usually write print("..."). In Incan you have both:

  • println("..."): prints with a newline (used in most examples)
  • print("..."): prints without a newline

Tip: Incan uses indentation for blocks. The canonical style is 4 spaces per indent level; run incan fmt to normalize formatting (see: Code formatting).

Run it

If you installed to PATH:

incan run hello.incn

If you used the no-install fallback:

./target/release/incan run hello.incn

Try it

  1. Change the message you print.
  2. Print two lines (two calls to println).
  3. Use print("...") once to see the “no newline” behavior.
One possible solution
def main() -> None:
    print("Hello")
    println(", Incan!")
    println("Second line")

Next

Next chapter: 2. Values, variables, and types.