style: auto-format example files with lux fmt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 06:52:44 -05:00
parent 8c90d5a8dc
commit 44ea1eebb0
54 changed files with 580 additions and 1483 deletions

View File

@@ -1,39 +1,22 @@
// Demonstrating Random and Time effects in Lux
//
// Expected output (values will vary):
// Rolling dice...
// Die 1: <random 1-6>
// Die 2: <random 1-6>
// Die 3: <random 1-6>
// Coin flip: <true/false>
// Random float: <0.0-1.0>
// Current time: <timestamp>
// Roll a single die (1-6)
fn rollDie(): Int with {Random} = Random.int(1, 6)
// Roll multiple dice and print results
fn rollDice(count: Int): Unit with {Random, Console} = {
if count > 0 then {
let value = rollDie()
Console.print("Die " + toString(4 - count) + ": " + toString(value))
rollDice(count - 1)
} else {
()
}
let value = rollDie()
Console.print("Die " + toString(4 - count) + ": " + toString(value))
rollDice(count - 1)
} else {
()
}
}
// Main function demonstrating random effects
fn main(): Unit with {Random, Console, Time} = {
Console.print("Rolling dice...")
rollDice(3)
let coin = Random.bool()
Console.print("Coin flip: " + toString(coin))
let f = Random.float()
Console.print("Random float: " + toString(f))
let now = Time.now()
Console.print("Current time: " + toString(now))
}