chore: add examples

This commit is contained in:
2026-02-05 01:51:27 +01:00
parent 70c26649d5
commit 27481e36bc
5 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
let var1 = 13
let var2 = "Hello"
let var3 = false
let var4 = var3
var4 = var2
var3 = null

View File

@@ -0,0 +1,5 @@
let a = 4
let b = 5
let c = a + b
c *= 7
let d = (3.2 - 0.2) + 4 * 6 / 2

View File

@@ -0,0 +1,9 @@
let a = 5
let b = 7
let equal = a == b
let not_equal = a != b
let less = a < b
let more = a > b
let less_eq = a <= b
let more_eq = a >= b

18
examples/04_if_else.peb Normal file
View File

@@ -0,0 +1,18 @@
let age = 14
if age >= 18 {
print("You are an adult")
} else {
print("You are a child)
}
let guess = 12
let secret = 14
if guess == secret {
print("You guessed the secret !")
} else if guess < secret {
print("You're too low")
} else {
print("You're too high")
}

17
examples/05_loop.peb Normal file
View File

@@ -0,0 +1,17 @@
for i from 1 to 5 {
print(i)
}
for j from 0 until 10 by 2 {
print(j)
}
for k to 4 {
print(k)
}
let l = 0
while l < 10 {
print(l)
l += 3
}