Hello World in Arkscript

Published on 03 October 2020 (Updated: 30 September 2024)

Welcome to the Hello World in Arkscript page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

(print "Hello, World!")

Hello World in Arkscript was written by:

This article was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

ArkScript programs do not require a main function as in C or C++. Every expression is executed, thus a single (print "Hello, World!") can write to the console.

A modular way to write the program could be as follows:

(let say (fun (to)
  (print (str:format "Hello, {}!" to))))

(say "World")
  1. The first line, (let say (fun (to), declares a function named say, taking a single argument, to.
  2. On the second line, we have a call to str:format: it takes a format string and values to be formatted
    1. This is then wrapped in a call to print to write the resulting string to the console
  3. On the last line, we call the say function with the argument World, printing Hello, World!

How to Run the Solution

Using the online playground:

  1. Go to playground.arkscript-lang.dev
  2. Copy the code you want to run, eg (print "Hello, World!"), and paste it in the editor
  3. Click the Run button

Using the interpreter:

  1. Download the latest release
  2. See the documentation in case you need help finding the correct binary & installing it
  3. Create a file.ark with your code inside
  4. Run it using arkscript file.ark

Using Docker:

  1. Pull arkscript/nightly:latest
  2. Create a file.ark with your code inside
  3. Run it using docker run --rm -v $(pwd):/tmp arkscript/nightly /tmp/file.ark