Functions
The function is now working with taking arguments and optional return
fn add argone argtwo
    | let sum = argone + argtwo
    | return = sum
add 1 2 output
print output
There's also a caching function that's perfect for doing things that is deterministic
cfn fib n
    | if n == 0 || n == 1
    |    | return = n
    | n -= 1
    | fib n outa
    | n -= 1
    | fib n outb
    | return outa + outb
Reassigning of variables
let a = 0
a += 1
print a
Read/Write files
This required a lot more but was fairly simple to implement here's how it's used
//filer is the read keyword second argument is path, third is content
filer "some.txt" content
//assign some text to the content
content += "some text"
//write the changed content back to same file
filew "some.txt" content
While doing this i realized it would be nice to take some data from a textfile and convert it to a number so i added that aswell.
filer "version-nr.txt" vernr
tonum vernr
vernr += 1
filew "version-nr.txt" vernr
System calls
Pretty simple implementation there's no safety though it's just does the command as it would be the user inputting the command
sys "echo 'some text' > 'text.txt'"
sys "cat 'text.txt'" output
print output
Loops
let i = 0
loop 0 25
   | print i
   | i += 1
Lists
//li += <value> appends
//li -= <value> looks for the value and removes it <br>
let li = []
let i = 0
loop 0 25
   | li += i
   | i += 1
li -= 12
print li
//Access individual elements using 'at'
let firstelement = li at 0
print firstelement
//or just
print li at 0
//print len of list
print li len
//list specific functions works for strings
let text = "some text"
print text len
print text at 2
Command arguments
//Example arguments hello world "!"
//prints 3
print argc
//prints [hello,world,!]
print argv
Imports
//imports somefilewithfunctions.hi
import "somefilewithfunctions"
 
     
                                
Comments (0)