Hello World in Squirrel

Our first program will print the classic “hello world” message. Here’s the full source code.

if __name__ == "__main__":
    print("hello world")

To run the program, save the code in a hello_world.py file and use the python command to execute it.

$ python hello_world.py
hello world

Sometimes we’ll want to build our programs into executables. While Python is an interpreted language, we can still create standalone executables using tools like PyInstaller.

First, install PyInstaller and then package the script into an executable:

$ pip install pyinstaller
$ pyinstaller --onefile hello_world.py
$ ls dist
hello_world

We can then execute the generated binary directly.

$ ./dist/hello_world
hello world

Now that we can run and build basic Python programs, let’s learn more about the language.