Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hello, World!

Now that the Andy C++ interpreter is installed we can write our first program.

First create a file called hello.ndc and add this code:

print("Hello, world!");

In Andy C++ we don’t need a main function. Semicolons are mandatory, just like they are in Rust. If you already know Rust, Andy C++ will feel very familiar.

$ ndc hello.ndc
Hello, world!

You can also pass a program on the command line with --eval (or -e), without creating a file. Errors in it are reported against <eval>:

$ ndc run --eval 'print("Hello, world!");'
Hello, world!