Dissection of Hello World in Operon

Hello World is a classic first application that is written when learning new language. Here's the Hello World in Operon:

Let's go through this line by line:

  1. As we can see, the query starts with the word "From". From is a keyword in Operon, and it tells from where we are going to get the data. Please note that the keywords in Operon start with the capital letters, so From has big F in it.

    After From comes the input-source, which first in our examples is most of the time "json". You might be familiar with JSON already, but if you are not, then don't worry, you will learn it fast by going through the examples. Here we say that the input is a JSON-string, which has the value "Hello world!".

    The From-statement is optional, so you may skip it. In this case the root-value will be an empty-value.

  2. Each query must have the Select-statement. Here we have this dollar-symbol ($) after our Select-keyword. It means that we want to select root value, which means the value that was assigned by our input-source, and in this case it is a JSON-string "Hello world!".

  3. Finally we have the line which starts with hashtag-symbol, followed by the greater-than -symbol. Everything followed by the hashtag-symbol means that it is a comment. This is how we denote the query's output while going through examples.

There's more than one way to do it

The above example is the canonical way to write the Hello World, but there are other ways to achieve this. Let's see a few alternatives.




Where to go next?

Check out next Operon 1-2-3 - first steps to learn Operon!