Sentinel value
This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Sentinel_value"
.

In computer programming, a sentinel value (also referred to as a flag value, rogue value, or signal value)citation needed is a special value that is used to terminate a loop that processes structured (especially sequential) data. The value should be selected in such a way that it will not be confused with legal data values.

Below are some examples of common sentinel values and their uses:

Sentinel values are often used when searching for something of importance.1

In safe languages, most uses of sentinel values could be replaced with option types, which enforce explicit handling of the exceptional case.

See also

Notes

  1. ^ McConnell, Steve. "Code Complete" Edition 2 Pg. 621 ISBN - 0-7356-1967-0
content
© jGames.co.uk 2007 (some content from Wikipedia under GDL ) !-- ValueClick Media 468x60 and 728x90 Banner CODE for jgames.co.uk -->
Your Ad Here