Refactoring for OOP
This commit is contained in:
@@ -1,17 +1,30 @@
|
||||
import("io")
|
||||
|
||||
dingus func {
|
||||
// println is an inbuilt function, you can also use print
|
||||
println("you got dingused")
|
||||
// for now, args for functions are accessed with arg0, arg1, etc
|
||||
print("You said: ")
|
||||
println(arg0)
|
||||
// set a variable, similar to Python
|
||||
x = 5
|
||||
println(x)
|
||||
// if statements are pretty standard
|
||||
if (true) {
|
||||
println("yay")
|
||||
}
|
||||
// types available are int, float, string, bool
|
||||
println(321)
|
||||
println(3.14)
|
||||
println("I am a string!")
|
||||
println(true)
|
||||
}
|
||||
|
||||
// main is the entry point of the program, like many other languages
|
||||
main func {
|
||||
dingus()
|
||||
// call a function (with arguments!)
|
||||
dingus("hehe")
|
||||
}
|
||||
|
||||
// run this if you dare! try adding it in the main function!
|
||||
infinity func {
|
||||
while (true) {
|
||||
println("to infinity and beyond!")
|
||||
|
||||
Reference in New Issue
Block a user