names-values.tri (537B)
1 !export greeting 2 !export answer 3 4 -- Give a value a name. 5 greeting = "Hello, world!" 6 -- Evaluate greeting with Text. 7 -- Result: Hello, world! 8 -- Try changing the words, then Evaluate again. 9 10 -- Numbers can have names too. 11 answer = 42 12 -- Choose answer in Definition. 13 -- It selects Natural number; the result is 42. 14 15 -- Exercise: change answer to your favourite number and evaluate it. 16 -- The !export lines make our names available to the playground. 17 -- Edits compile after a pause; Evaluate runs the expression. 18 -- Next: Doing arithmetic.