Skip to content
Your progress

Checking your sign-in…

Who's learning?

Each profile keeps its own read lessons, badges, streak, and practice scores on this device.

Lesson 1 of 11

One record, one row

Show on a big screen

8 min

Text size

A register is a school's list of its students. Every student in it is one row. A section is a class group, such as 9-A. The due is the fee money a student still owes, in rupees. Positions count from 0, so rows[2] is the third row.

Five rows, one heading row above them.
Step 1 of 4
  1. Five rows, one heading row above them.
  2. In this register, position 0 is the admission number.
  3. In this register, position 3 is the due.
  4. rows[2][3] reads Chandni's due: 1450.

The rule

A record is one row of values that belong together. The heading row names the columns. One field takes two positions: first the row, then the column.

The full register has twelve rows, not five:

The office register of an invented school: one heading row, twelve records
admissionnamesectiondue
A-101Aarti Kulkarni9-A3200
A-102Bharat Iyer9-A0
A-103Chandni Shah9-B1450
A-104Dev Patil9-A800
A-105Esha Rao9-B3200
A-106Farid Khan9-A1450
A-107Gauri Menon9-B0
A-108Ananya Suresh9-A1450
A-109Hari Verma9-B2050
A-110Ananya Suresh9-A2050
A-111Ishita Bose9-B1450
A-112Rhea Mehta9-A900

Every record here is invented. If a name sounds familiar, that is a coincidence.

The lab asks for a position past a row's end, on purpose. A row has four values, positions 0 to 3. The runner is the tool that runs your code. In this course's runner, asking for position 4 stops the run. It says: You asked for position 4, but the list has 4 items.

To fetch a field is to read that one value. The walk is open below. Predict each fetched field, then reveal it.

Loading lab…

Every field a program reads takes two positions.

Try the lab to finish this lesson.