29–43 solutions

29. No need for numbers.

move forwards

repeat until... at destination

30. Can you do that again?

turn left

turn right

repeat until... at destination

31. Practice makes perfect

move forwards

turn left

turn right

repeat until... at destination

32. Uh oh, it’s ‘until’ fever!

move forwards

turn left

turn right

repeat until... at destination

LKS3–S3 - If... only

  • Understand selection using the if... do... statement

  • Understand that you can use an if statement inside a repeat loop

  • Use this knowledge to create short, efficient programs to complete simple single routes

Note: Although else if is not introduced until Session 5, solutions using this statement will still get a full score.

33. Now it’s time to try the ‘if’ block.

move forwards

repeat until... at destination

if... do...

34. Multiple 'ifs'

move forwards

turn left

repeat until... at destination

if... do...

35. Let's pull it all together

move forwards

turn left

turn right

repeat until... at destination

if... do...

LKS3–S4 - General solution using repeat until and if... do

  • Understand selection using the if... do... statement

  • Understand that you can use an if statement inside a repeat loop

  • Understand the idea of a general solution, e.g. a program which works for any single road

Extension: use if... do... else if...

36. What else? ‘if-else’, that’s what!

move forwards

turn left

turn right

repeat until... at destination

if... do...

Extension:

if... do... else if...

37. A bit longer.

move forwards

turn left

turn right

repeat until... at destination

if... do...

Extension:

if... do... else if...

38. Third time lucky!

move forwards

turn left

turn right

repeat until... at destination

if... do...

Extension:

if... do... else if...

LKS3–S5 - Extension group activity

  • To understand why their general solution for a single route may not work on a complex route with junctions

  • To understand the if… do… else if… statement

  • To understand that the order of the if statements in your program makes a difference

Note: At Level 39, a solution using if and else if will work, but in this case it is not the most efficient solution

39. Third time lucky!

move forwards

turn left

repeat until... at destination

if... do...else if...

40. Adjust your previous solution.

move forwards

turn left

turn right

repeat until... at destination

if... do...else if...

41. Decision time.

move forwards

turn left

turn right

repeat until... at destination

if... do...else if...

42. What do you think this time?

move forwards

turn left

turn right

repeat

43. Good work! What else can you do?

move forwards

turn left

turn right

repeat

if... do... else if...

Last updated