Echo Writes Code

proc.orchid

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

import! orchid.console;

main! {
	-- Any procedure can be invoked via the `call! PROC [ARGS...]` statement.
	call! silly_say "Hello, Orchid";
}

-- The `proc! NAME (ARG: TYPE...) : RET { CODE... }` statement defines a new procedure, which is
-- very similar to a function from C-like languages. This type of object is called a procedure in
-- Orchid because functions are something different.
--
-- The return type delimiter is a colon instead of the more typical arrow to keep the tokenizer
-- simpler (since `-` is already used to detect negative integers and floats).
proc! silly_say (message: String) : None {
	call! console.write_line message;
}