Code Crew G1 / Week 04 / Thursday
4/6
Week 04 · Bug Hunt in the Lines

Thursday

The lazy line
// Find the bug, fix the line
⏱ about 15 min
Rocket the inventor holding his engineering tablet

A line does nothing!

This program reaches the flag.

But one line does nothing!

It just takes up space.

WARM-UP: GAP CHECK
  • Say the plan.
  • Tap the missing line.
move up
missing line
move right
?
move right
move up
missing line
?
A program with a lazy line: move right, wiggle wings, move right, move up

Every line has a job

The plan: right, right, up.

The program has four lines.

One line is extra!

Raven the explorer with her wrist computer

What do you notice?

Check each line: plan work?

Wiggle wings does no plan work.

That is the lazy line!

Nova the drone-bird hovering with glowing eyes

Nova wiggles anyway

Nova runs lazy lines too.

Exactly and proudly!

So coders cut them out.

FIND THE WASTED LINE
  • Say the plan.
  • Tap the line doing nothing.
find the lazy line
?
find the lazy line
?
find the lazy line
?

Now check line by line.

Does each line help the plan?

Tap T or F.

linehelps the plan?
move right?
spin around?
move right?
move up?

Time for the best fix.

Rebuild it WITHOUT the lazy line.

Shorter is better!

REBUILD IT SHORTER
  • The plan: right, right, up.
  • Three lines. No lazy ones!
1line 1
2line 2
3line 3

Short and strong!

Every line should help the plan.

Cut the lazy ones.

Shorter is better!

← Wednesday