Introduction
The Calypso Book is a guide on how to write code in Calypso.
Currently this guide will not describe the Calypso build tool and command-line interface as those are not yet fully designed (and they may get their own book eventualy).
Notation
Calypso code will be written in code blocks like this:
fn main() ->
println("Hello, world!")
end
Things to look out for or further explanations of things may be provided in notes like this:
Note: This is a note!
Or in warnings like this:
Warning: This is a warning. Oh no!
Welcome to Calypso!
This chapter will educate you on most of the basics on getting started with Calypso, up to a “Hello, world!” example. In the future this will contain installation instructions.
Hello, world!
No programming language guide would be complete without a “Hello, world!” example.
Code in Calypso is organized in “statements”. These are complete lines of code ending with a semicolon.
To print text to the console, you call the function println
with the string of text you would like to print.
To do this, you type the name of the function, followed by an opening parentheses, then the arguments
(in this case, a string of text), then a closing parentheses. Enough talk, let’s get to the code!
Open the REPL and run this:
println("Hello, world!")
Calypso requires you to define a main function when you’re not running a program in the REPL. This function will always be executed at the beginning of the program. You can define a main function like this:
fn main() ->
println("Hello, world!")
end