Syntax
type
Pylo has a function called "type" that allows you to distinguish between different types of objects, such as numbers and text. However, type errors do not usually occur due to type.
str
Text (String)
"Hello"
long str
Long Text (String)
"""
Hello
This is Text that Include Multiple Line
"""
int
Number (Int)
1234
-2345
float
Number (Float)
1.23
-2.34
list
Array (List)
[1,2,3,4]
["a","B","1","!"]
bool
True or False (Bool)
true
false
auto
It will automatically infer the type.
var a = "Hello"
var b: auto = 1234
object
Any Object.
Exists for compatibility with Python. This is used when importing from Python.
comment
Adding a string that has no effect on execution
show("Hello!") # This is Comment
// This is Also Comment
var
Define Variable
var myvar = 1234
use var
Use Variable
var myvar = 1234
show(myvar) # Show 1234 to stdout
func
Define Function
func myfunc(a, b) {
show(conv.str(a + b))
}
Return Content
Added on Pylo 3.2
func add(a, b) {
return a + b
}
use func
Use Function
myfunc(1, 2) # Show 3 to stdout
if
If 0 is Not 0...?
if (0 == 0) {
show("Okay. It's Safe...")
}
while
Do not use while (1 == 1)
var limit: int = 5
var current: int = 0
while (current < limit) {
var current: int = current + 1
show(current)
}
for
1.. 2.. 3.. 4.. 5.. Wait, how far did I count?
for item in [1, 2, 3, 4, 5] {
show(item)
}
math
func s(content) {
show(content)
}
s(1 + 1) # 2
s(1 - 1) # 0
s(3 * 2) # 6
s(10 / 2) # 5.0
s(1 < 2) # True
s(1 > 2) # False
s(5 <= 5) # True
s(5 >= 6) # False
s(5 == 5) # True
s(5 != 5) # False
Last updated