Learn FALCON with Real Code Examples
Updated Nov 20, 2025
Code Sample Descriptions
1
Falcon Counter and Theme Toggle
count := 0
isDark := false
func updateUI() {
print("Counter: " + count + "\n")
print("Theme: " + (if isDark then "Dark" else "Light") + "\n")
}
func increment() {
count += 1
updateUI()
}
func decrement() {
count -= 1
updateUI()
}
func reset() {
count = 0
updateUI()
}
func toggleTheme() {
isDark = !isDark
updateUI()
}
# Simulate actions
updateUI()
increment()
increment()
toggleTheme()
decrement()
reset()
Demonstrates a simple counter with theme toggling using Falcon variables and functions.
2
Falcon Fibonacci Sequence
a := 0
b := 1
print(a)
print(b)
for i in 1..8 {
c := a + b
print(c)
a = b
b = c
}
Generates first 10 Fibonacci numbers.
3
Falcon Factorial Calculator
func fact(n) {
if n == 0 { return 1 }
return n * fact(n-1)
}
print(fact(5))
Calculates factorial of a number recursively.
4
Falcon Prime Checker
func isPrime(n) {
if n < 2 { return false }
for i in 2..n-1 {
if n % i == 0 { return false }
}
return true
}
print(isPrime(13))
Checks if a number is prime.
5
Falcon Sum of Array
nums := [1,2,3,4,5]
sum := 0
for n in nums { sum += n }
print(sum)
Calculates the sum of an array of numbers.
6
Falcon Reverse String
s := "HELLO"
r := ''
for i in reverse(0..s.len-1) { r += s[i] }
print(r)
Reverses a string.
7
Falcon Multiplication Table
n := 5
for i in 1..10 { print(n + ' x ' + i + ' = ' + n*i) }
Prints multiplication table of a number.
8
Falcon Celsius to Fahrenheit
c := 25.0
f := (c * 9/5) + 32
print(f)
Converts Celsius to Fahrenheit.
9
Falcon Simple Alarm Simulation
temp := 80
thresh := 75
if temp > thresh { print('Alarm: Temperature Too High!') } else { print('Temperature Normal') }
Simulates an alarm if threshold is exceeded.
10
Falcon Random Walk Simulation
steps := 10
pos := 0
for i in 1..steps {
pos += if rand(0,1) < 0.5 then -1 else 1
print(pos)
}
Simulates a 1D random walk.