Chapter 1: a second greeting, typed

Chapter 1's Greeting is HelloWorld with a second line. The IDE writes the program's shell - the same New Construct ▸ Program… every later chapter uses - and you type the two prints. To play it in the IDE: Help > Lessons > Getting Started with EK9…, or ek9 -ide -lesson book-greeting.

The EK9 IDE as the lesson opens

What you'll build

The lesson builds this program from a file holding only its module line - the finished file, as the book prints it.

#!ek9
defines module introduction

  defines program

    Greeting()
      stdout <- Stdout()
      stdout.println("Hello, World")
      stdout.println("Welcome to EK9")

//EOF

Step 1: The program's shell

Choose Code > New Construct > Program…

The EK9 IDE once this is done: Choose Code > New Construct > Program…

Greeting is the program's name. Type it and choose Preview.

The EK9 IDE just before choosing Preview: Greeting is the program's name

The preview shows Greeting about to be written. Choose Apply.

The EK9 IDE just before choosing Apply: The preview shows Greeting about to be written

The tool leaves no blank line before the program: select the Greeting() line and, above it, type the one the book opens with. Saves when typed.

The EK9 IDE once this is done: The tool leaves no blank line before the program

Step 2: The body, typed

Select the stub, from ready <- true down to its //AI line, and type the body exactly as the chapter shows it. Saves when typed.

The EK9 IDE once this is done: Select the stub, from ready <- true down to its //AI line, and type the body exactly as the chapter shows it

Step 3: Run it

Choose Run > Run Program…

The EK9 IDE once this is done: Choose Run > Run Program…

The project's only program is already chosen. Choose Run.

Hello, World, then Welcome to EK9. Choose Close.

The EK9 IDE just before choosing Close: Hello, World, then Welcome to EK9

The result

Greeting.ek9 now reads exactly as chapter 1 of Getting Started with EK9 shows it: a Stdout, and two println calls. The shell was the tool's (ek9_add_program); the two lines are yours.

The EK9 IDE when the lesson has finished

Where this lesson comes from