Files use .rex, the command is rex, and the crate, runtime prefixes, docs, editor files and examples all use the new name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
757 B
Rexx
52 lines
757 B
Rexx
const LIMIT = 20
|
|
|
|
func is_prime(n: int): bool {
|
|
if n < 2 {
|
|
return false
|
|
}
|
|
var d = 2
|
|
for d * d <= n {
|
|
if n % d == 0 {
|
|
return false
|
|
}
|
|
d += 1
|
|
}
|
|
return true
|
|
}
|
|
|
|
func main() {
|
|
var sum = 0
|
|
for i in 1..11 {
|
|
sum += i
|
|
}
|
|
print("sum 1..10 =", sum)
|
|
|
|
print("evens:")
|
|
for i in 0..LIMIT step 2 {
|
|
print(i)
|
|
}
|
|
|
|
print("countdown:")
|
|
for i in 5..0 step -1 {
|
|
print(i)
|
|
}
|
|
|
|
var primes = ""
|
|
for n in 0..LIMIT {
|
|
if !is_prime(n) {
|
|
continue
|
|
}
|
|
primes += "{n} "
|
|
}
|
|
print("primes:", primes)
|
|
|
|
var k = 0
|
|
for {
|
|
k += 1
|
|
if k == 3 {
|
|
break
|
|
}
|
|
}
|
|
print("k =", k)
|
|
}
|