Hello World

The code for a simple hello world program is:

hello-world.idio
echo "Hello World"

Save that in a file called hello-world.idio.

Idio, by default, will only look in some standardized library directories which probably doesn’t include the directory where you’ve just saved that file. We can extend the places Idio will search for library files in by setting the environment variable IDIOLIB with a colon-separated list of directories:

$ export IDIOLIB=$PWD

$ idio hello-world
Hello World

Thoughts

Idio doesn’t have an echo function so it has looked for an external command called echo on your PATH.

There are, of course, other ways to print strings which we’ll come to in due course but the obvious one is:

printf "Hello World\n"

This is using an Idio function called printf (rather than the external command, printf) which supports printing out Idio values.

Last built at 2024-05-19T06:11:39Z+0000 from 77077af (dev) for Idio 0.3