Language Reference
This reference explains Emerald’s language one idea at a time. Each page introduces a construct, shows it in a short program with the output it prints, and points out the mistakes people most often make with it, along with what Emerald says when they happen.
If you are new to Emerald, or to programming, read the pages in order, starting with The First Program. Each one builds on the pages before it, and the Next link at the bottom of every page takes you to the one after it. If you already know another language, skim the headings and read the pages whose ideas are new to you.
Before you start, install Emerald so you can run the examples yourself. Typing an example in and running it teaches more than reading it.
What the pages cover
Section titled “What the pages cover”- The basics: the first program, comments, variables and constants, numbers, text, and true and false.
- Making decisions and repeating: operators,
ifandelse,case, and loops. - Functions: declaring functions, and passing blocks of code to them.
- Values that might be missing: optionals.
- Collections: lists, dictionaries, sets, tuples, and ranges.
- Your own types: structs, classes, properties, inheritance, traits, enums, types nested inside other types, and operator overloading.
- Larger programs: errors, tests, projects and namespaces, and annotations.
The types and functions that come with Emerald, such as String, List, print, and Math,
have their own pages under Built-ins and Standard Library.