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,53 @@
|
||||
struct User {
|
||||
name: string
|
||||
age: int
|
||||
}
|
||||
|
||||
func find(id: int): User? {
|
||||
if id == 1 {
|
||||
return User{name: "Ann", age: 30}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func first_even(xs: []int): int? {
|
||||
for x in xs {
|
||||
if x % 2 == 0 { return x }
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func describe(id: int): string {
|
||||
var u = find(id)
|
||||
if u == nil {
|
||||
return "nobody"
|
||||
}
|
||||
return "{u.name} is {u.age}"
|
||||
}
|
||||
|
||||
func main() {
|
||||
print(describe(1))
|
||||
print(describe(2))
|
||||
|
||||
var n = first_even([1, 3, 4, 5])
|
||||
if n != nil {
|
||||
print("first even:", n + 1)
|
||||
}
|
||||
var m: int? = first_even([1, 3])
|
||||
print("m is", m)
|
||||
print("n is", n)
|
||||
|
||||
var count: int? = 5
|
||||
if count != nil && count > 3 {
|
||||
print("big count")
|
||||
}
|
||||
count = nil
|
||||
if count == nil || count > 100 {
|
||||
print("no count")
|
||||
}
|
||||
|
||||
var list: []int? = nil
|
||||
if list == nil {
|
||||
print("no list")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user