Lesson 1.4: Inputs, Outputs, and Value Tracing
An input is information a program or operation receives. An output is information it sends out. In the practice runner, blocks provide inputs to other blocks, and the print block sends visible output.
A trace records important values in execution order. It answers questions such as: What was score before this command? Which expression produced the next value? What was printed?
Consider this program:
- Set
scoreto 4. - Print
score. - Change
scoreby 3. - Print
score.
Its outputs are 4 and 7. The first print does not change when a later command changes the variable.
Guided practice
Build that program, predict both outputs, and use Step to verify the trace. Then set bonus to 2 and change score by the value stored in bonus.
Make a small table with one row per instruction. Include the instruction number, score, bonus, and any new output. If the actual trace differs from your table, find the first row that differs before editing the program.
Loading the block workspace...
Ready to move on?
Only mark complete if you genuinely understand the material. Your progress will be saved in this browser.
Stuck on this lesson?
Ask about anything on this page. It can see which lesson you have open and which part you are reading.