Assigning a record copies it

Complete the previous lesson to unlock this one.

Back to the path

Assigning a record copies it

Level 1: Records. Pupil2 <- Pupil1 copies the fields. Changing one record afterwards does not change the other. Objects do not work this way — records do.

This program copies Pupil1 into Pupil2, then changes Pupil1.Name to Smith.

It prints the wrong name. Output the copy, which must still be Johnson.