Rename the language from Dino to Rex
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>
This commit is contained in:
1 parent
2f44f09b6a
commit
7cf9727bcd
94 files changed
+858
-858
No files matched your search
@@ -0,0 +1,51 @@
|
||||
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)
|
||||
}
|
||||
Reference in new issue
Block a user