-
Notifications
You must be signed in to change notification settings - Fork 1
Basics
Splizard edited this page May 1, 2018
·
12 revisions
n = 3
s = "string"
concept add(a,b) {
return a+b
}
concept printchars(s) {
for char in s
print(char)
end
}
concept hello() {
return "hello"
}
If statements take numeric values, 0 is false, anything else is true.
if expression
print("expression is true!")
else if condition
print("expression is false...")
print("but condition is true!")
else
print("expression and condition are false...")
end
The loop statement loops over the enclosed block of code an unspecified amount of times, it's up to you to break out of the loop when you need to.
loop {
if leaving
break
end
}
The for loop is more useful as it strictly specifies how many times the loop will run.
for element in array
print(element)
if bad(element)
delete() //--This deletes the element (does not preserve order)
end
end
for value in array
print(i, ":", value)
end
for each 0 to 10
print(i)
end
for each in array
print(i)
end
The errors block will run if there has been an error.
n = number("abc")
errors {
print("Could not convert abc to a number!")
}