Type Instructions

From Onix OS Wiki
Jump to: navigation, search

Writing programs in this language is simple. What's more important than spaces is how you write the code. For example, regular writing is required. Otherwise, you won't find out where you put it. If you want to remember how you did it, take a look at this example;


Wrong Usage

This is not a problem because it is short. But writing irregular code is like making spaghetti.

trianglesum.olm

def triangleSumEdges = fn(x,y,z){ return (x+y+z); }
triangleSumEdges(3,3,3)

result

9

Correct Usage

It is not necessary to write everything long, but in some cases it is necessary to write long. You need to extract the module module.

main.ola

# Loads triangle.olm file
load "triangle.olm"

# run on module
triangle->sumEdges(3,3,3)


triangle.olm

scope triangle{
   def sumEdges = fn(x,y,z){
      return (x+y+z);
   }
}

results

9

As you can see, the spaces or the tables do not matter, but it will contribute to you when you write this way regularly. You should always install the modules at the top when installing them. Otherwise, the loading module is used only after loading the file.