System Tokens

From Onix OS Wiki
Jump to: navigation, search

All the "literal" token lists used in this language are given. For general information purposes only. If you hang out, you can see what you do.

fn

Function: def object = fn(...){....}

def

def object = something

true

Boolean: true

false

Boolean: false

if

if(...boolean){ .... }

else

else{ .... }

return

def pi = fn(){** return ("3.14") **}

show

show(object)

println

println(object)

loop

loop(condition){...result}
def result = (loop(condition){return ...result})
# => ....results array or object

Example

def i = 0;
loop(i>100){
  println(i);
  def i = (i+1);
}
# => ...results...

for

For loop generates results from loops

def arr = [1,2,3,4,5]
for(arr in k,v){
  println(v)
}
def arrtwo = {"one":1, "two":2};
for(arrtwo in k,v){
  println(k)
  println(v)
}
...results...


load

Load some olang module, file etc:

load "filename"

scope

Create scope for functions or variables:

scope scopename {
  def scopevar = somevariable;
  def scopefn = fn(....){....}
}
scopename::scopevar
scopename::scopefn(....)

proc

Create system process;

proc procname "command" "work path" ["arg1","arg2"]
# => ....process result

sock

Create system socket;

sock socketname "type" "port" "ip"
# => ...sock result

env

Create system environment value or change;

env "type" "value"
getenv(result)
# => ....value