Look up one field

Complete the previous lesson to unlock this one.

Back to the path

Look up one field

Level 1: Records. A typical Paper 2 task is an array of records plus a search for one field, instead of two parallel arrays.

The array is already filled. Read a name. Output that student's mark, or Not found if the name is not there.

Example: input Ada → 80. Input Zed → Not found.

Plan it in three steps:

  1. Set a flag Found <- FALSE before the loop.
  2. Inside the FOR loop, IF the name matches: OUTPUT the mark and set Found <- TRUE. No ELSE here — it would print "Not found" for every non-match.
  3. After NEXT, IF Found = FALSE then OUTPUT "Not found".