diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-25 15:40:59 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-25 15:40:59 -0400 |
| commit | 1f9147187d66e95a0ffedd4d5595ec98646b5fe1 (patch) | |
| tree | 14281e5cbde8e15fae63953b72844fb1a11d6f73 /examples | |
| parent | d88d8648dc7802fbeac2f28dc5f2ef8fdfe1a9e4 (diff) | |
Make docstring tests use an actual expression AST instead of text
matching
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/learnxiny.tm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/learnxiny.tm b/examples/learnxiny.tm index e2058558..00c7e94a 100644 --- a/examples/learnxiny.tm +++ b/examples/learnxiny.tm @@ -106,21 +106,21 @@ func main(): # Tables are efficient hash maps table := {"one"=1, "two"=2} >> table["two"] - = 2 : Int? + = 2? # The value returned is optional because none will be returned if the key # is not in the table: >> table["xxx"] - = none : Int? + = none : Int # Optional values can be converted to regular values using `!` (which will # create a runtime error if the value is null): >> table["two"]! - = 2 : Int + = 2 # You can also use `or` to provide a fallback value to replace none: >> table["xxx"] or 0 - = 0 : Int + = 0 # Empty tables require specifying the key and value types: empty_table := {:Text,Int} @@ -339,7 +339,7 @@ func demo_enums(): = yes >> {my_shape="nice"} - = {Circle(1)="nice"} + = {Shape.Circle(1)="nice"} func demo_lambdas(): # Lambdas, or anonymous functions, can be used like this: |
