Small Steps I — Creating with Text and Numbers

Running from top to bottom

Print your name, something you like, and something you want to make on three lines.

What you will learn

When you write several instructions, they run from top to bottom. print moves to a new line after producing its output.

Try it

Example · example.cpp
void small_main()
{
    print("Hello!");
    print("Small C++");
}

After the first print finishes, the second one runs. Swapping the two lines swaps the order of the output.

In code, everything from // to the end of that line is a comment. It is a note for people and does not run. Put // before the first instruction and see what changes.

Expected output:

Hello!
Small C++

Exercise

Print your name, something you like, and something you want to make on three lines.

Exercise starter · exercise_starter.cpp
void small_main()
{
    print("Hello!");
    print("Small C++");
}

Hint

Change the parts of the example that you need.

show solution
void small_main()
{
    print("Alex");
    print("Games");
    print("My game");
}
← Previous lessonNext lesson →