Hello and print
A Maylang file contains declarations and top-level statements. The program starts at the first statement and runs to the end.
print("Hello, Maylang!");
let name: Str = "Ada";
print("Hello, ${name}!");Output
Hello, Maylang!
Hello, Ada!print writes its arguments separated by spaces and always ends the line with a newline. String interpolation uses ${expression} and works for any value:
let answer: Int = 6 * 7;
print("answer: ${answer}");Output
answer: 42Comments start with // and run to the end of the line. Block comments use /* ... */ and nest.
Try it yourself
Create a workspace, replace src/main.may with the first sample, and run it:
may new hello
cd hello
may runNext
Continue to Values and types.