Getting Started‎ > ‎

Hello world

The Hello World program: hello.zu:

FUNC Main() int
  IO.write("Hello, World!\n")
  RETURN 0
}

Notes:
  • The entry point to the program is the Main() function.
  • The return value of the function is an int, an integer.  It goes after the arguments in ().
  • Keywords are in capitals, this avoids the problem that you need to know all keywords when picking a name.  And it allows for adding keywords later without breaking any existing Zimbu program.
  • The IO module contains I/O stuff.  IO.write() writes to stdout.  IO.stdout.write() would do the same.  In Zimbu things that you use often are kept short.  The long form is available for consistency.
  • The IO module is part of the language, no need to import it, we know where it is.
  • "\n" is a newline character. String escape characters are used like in C and Java.  There also is IO.writeLine() which appends the newline character.
  • There is no semicolon to end a statement.
  • The Main() function returns a zero.  This is equivalent to EXIT 0.
  • The } character is used to end a block.  There is no {, we know where the block starts.  This avoids useless discussions about where to put the {.

More examples:
Comments