Echo Writes Code

mutate.orchid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- An Orchid program demonstrating the use of the `mutate!` keyword.

import! orchid.console;

main! {
	-- Mutable data is bound the exact same way as immutable data. The compiler figures out whether or
	-- not a binding is mutable by the presence of `mutate!` statements in the same procedure.
	bind! message = "Hello, ";

	-- The `mutate! EXPR = EXPR;` statement edits the data stored in a mutable binding.
	mutate! message = message + "Orchid!";

	-- Mutable bindings can be passed to procedure invocations exactly the same way that immutable ones can.
	call! console.write_line message;
}