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
@@ -4,7 +4,7 @@
|
||||
|
||||
An ordered, growable sequence.
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var nums = [10, 20, 30]
|
||||
nums.push(40)
|
||||
@@ -35,7 +35,7 @@ Facts:
|
||||
- Going outside the list (`nums[9]`) or popping an empty list stops the program with a message.
|
||||
- **Lists are values.** `var b = a` copies the list. Changing `b` leaves `a` alone.
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var a = [1, 2, 3]
|
||||
var b = a
|
||||
@@ -51,7 +51,7 @@ func main() {
|
||||
|
||||
A map finds a value by a **key** instead of a position, like a phone book.
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var ages = {"alice": 30, "bob": 25}
|
||||
ages["carol"] = 41 // add a new entry
|
||||
@@ -67,7 +67,7 @@ func main() {
|
||||
|
||||
### Making a map
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var a = {"x": 1, "y": 2} // types are guessed from the entries
|
||||
var b: map[string, int] = {} // empty: the type comes from the variable
|
||||
@@ -100,7 +100,7 @@ The value can be anything: numbers, strings, lists, structs, even other maps.
|
||||
| `m.keys()` | a list of the keys |
|
||||
| `m.values()` | a list of the values |
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var stock = {"apple": 3, "pear": 0}
|
||||
print(stock.has("apple"), stock.has("fig"))
|
||||
@@ -120,7 +120,7 @@ true false
|
||||
|
||||
`m[k] = v` adds or replaces. `m.remove(k)` deletes (and does nothing if the key is missing).
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var m = {"a": 1, "b": 2}
|
||||
m["c"] = 3
|
||||
@@ -137,7 +137,7 @@ func main() {
|
||||
The most common map job is counting. `m[k] += 1` on a key that isn't there yet starts from
|
||||
zero, so you don't have to check first.
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var counts: map[string, int] = {}
|
||||
for w in "a b a c b a".split(" ") {
|
||||
@@ -156,7 +156,7 @@ func main() {
|
||||
|
||||
Entries come out **in the order they were added**, so output is always predictable.
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var prices = {"tea": 2.5, "cake": 4.0}
|
||||
for name, price in prices {
|
||||
@@ -178,7 +178,7 @@ cake
|
||||
|
||||
`var b = a` copies the whole map. A map inside a struct is copied with the struct.
|
||||
|
||||
```dino
|
||||
```rex
|
||||
func main() {
|
||||
var a = {"x": 1}
|
||||
var b = a
|
||||
|
||||
Reference in new issue
Block a user