Skip to content

Write your first program

Welcome to the "Hello, World!" tutorial for Zynk. In this guide, we'll create a simple Zynk program that prints "Hello, World!" to the console. Follow the steps below to get started.

1. Create a new Zynk file

First, you'll need to create a new file with a .zk extension. This file will contain your Zynk code.

  1. Open your favorite text editor or IDE.
  2. Create a new file and save it as hello.zk.

2. Write your Zynk program

In the hello.zk file, write the following Zynk code:

println("Hello, World!");

Explanation

  • println("Hello, World!");: This line of code calls the println function, which outputs the string "Hello, World!" to the console followed by a newline character.

3. Run your Zynk program

To run your Zynk program, follow these steps:

  1. Open a Terminal or Command Prompt.
  2. Navigate to the directory containing your hello.zk file. For example:

    cd path/to/your/directory

  3. Execute the Zynk interpreter with your file as an argument:

    ./Zynk hello.zk

Expected Output

When you run the program, you should see the following output:

Hello, World!

4. Troubleshooting

If you encounter any issues, make sure of the following:

  • The Zynk interpreter is correctly installed and located in your system's PATH.
  • The file extension is .zk and the code is properly written.
  • You are running the command from the directory where hello.zk is located.