sentinel

A special value that cannot occur in the real data and signals the end of it, such as an empty line ending a list of entries.

In more detail

A sentinel loop reads a value, checks it against the sentinel, and only then processes it, so the sentinel itself is never treated as data. It works however many items the user enters.

Example

line = input("Next: ")
while line != "":
    items.append(line)
    line = input("Next: ")

Related terms

Taught in

References