Hello World in Wren

Published on 02 May 2019 (Updated: 02 May 2019)

Hello World in Wren

In this article, we’ll tackle Hello World in Wren.

How to Implement the Solution

At any rate, let’s get right to our implementation of Hello World in Wren:

System.print("Hello, World!")

And, that’s it! Personally, I’m getting hints of Java and Python here just in terms of syntax.

At any rate, let’s break it down. Obviously, we only have one line, but it’s at least a little more interesting than most scripting languages.

For starters, we have the built-in System class. This class comes with the core module along with a few other goodies like String, Sequence, Fiber, and Bool.

Now, one of the functions of System is print. Obviously, print writes text to standard output. But, I find Wren’s print functionality particularly interesting because it’s similar to Java. In fact, it accepts any object as input. If the input is not a String, print will convert it to a String using the toString functionality, a method available to all objects.

So, basically we call the static method print of the System class which prints the input to the user. How cool is that?1

How to Run the Solution

Normally, at this point, I would share an example of how to run the solution on your machine. Unfortunately, Wren is rather new and a little clunky to get running. That said, I won’t leave you hanging, There are some directions for Mac and Linux users on the Wren website.

Alternatively, you can use the online Wren editor. Just copy the code from above into the editor and hit run.1


References

  1. J. Grifski, “Hello World in Wren,” The Renegade Coder, 23-Apr-2018. [Online]. Available: https://therenegadecoder.com/code/hello-world-in-wren/. [Accessed: 02-May-2019].  2