started writing examples for the syntax
This commit is contained in:
9
tests/conditionals.pla
Normal file
9
tests/conditionals.pla
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
depend "io.pla"
|
||||||
|
|
||||||
|
if (1 + 2 == 3) {
|
||||||
|
print("The universe is functional!")
|
||||||
|
}
|
||||||
|
unless
|
||||||
|
{
|
||||||
|
print("WHAT, HOW")
|
||||||
|
}
|
||||||
8
tests/functions.pla
Normal file
8
tests/functions.pla
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
depend "io.pla"
|
||||||
|
depend "string.pla"
|
||||||
|
|
||||||
|
add = Func(a: Int, b: Int): Int {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
|
||||||
|
print(String(add(1, 3)))
|
||||||
2
tests/helloWorld.pla
Normal file
2
tests/helloWorld.pla
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
depend "io.pla"
|
||||||
|
write("Hello, World!")
|
||||||
13
tests/variables.pla
Normal file
13
tests/variables.pla
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
depend "string.pla"
|
||||||
|
|
||||||
|
myInt: Int = 123
|
||||||
|
myDecimal: Float = 0.456
|
||||||
|
myBoolean: Bool = true
|
||||||
|
myString: String = "Hello!\n"
|
||||||
|
myList: List = [1, "hi", true, [1, 2, 3], 0.789]
|
||||||
|
|
||||||
|
write(String(myInt))
|
||||||
|
write(String(myDecimal))
|
||||||
|
write(String(myBoolean))
|
||||||
|
write(myString)
|
||||||
|
write(String(myList))
|
||||||
Reference in New Issue
Block a user