Skip to content

Practice — Change, predict, fix ​

Use these after Lesson 1–Lesson 3. Run each program in the Playground or with elang.

This page is practice, not reference.

Change it ​

1. Greeting ​

echo
say("Hello, Echo!");

Task: Change the message to greet a friend.

2. Variable ​

echo
name: str = "Echo";
say(name);

Task: Change the value so the program prints your name.

3. Decision ​

echo
temp: int = 20;

if temp >= 25 {
    say("Warm");
} else {
    say("Cool");
}

Task: Change temp so the program prints Warm.


Predict it ​

Do not run these until you write your guess.

4. ​

echo
n: int = 2;
say(n + 3);
Answer
text
5

5. ​

echo
flag: bool = false;

if flag {
    say("yes");
} else {
    say("no");
}
Answer
text
no

6. ​

echo
i: int = 1;

while i <= 2 {
    say(i);
    i = i + 1;
}
Answer
text
1
2

Fix it ​

7. Missing semicolon ​

echo
say("Hello, Echo!")

Task: Make it run. Hint: instructions end with ;.

Fixed
echo
say("Hello, Echo!");

8. Missing type on first use ​

echo
count = 1;
say(count);

Task: Declare count properly.

Fixed
echo
count: int = 1;
say(count);

9. Missing braces ​

echo
if true
    say("ok");
Fixed
echo
if true {
    say("ok");
}

Next ​

→ Small exercises

Echo is in active development. The docs reflect the current implementation.