In computer science, in the field of programming, a sentinel (English for guard), is a construct which terminates a sequence in such a way that the program logic finally runs (with unreal success) to the result "found" after an unsuccessful inspection of all real cases. If so done, the result is subsequently corrected to "not found". This trick reduces the number of queries within the search loop by one, namely the query on the end of the sequence - at the expense of slightly more complicated requirements and actions outside the loop. In a broader sense, any termination of a sequence by a special object not normally occurring there, e.g. the null character in strings, is considered a sentinel.
Sentinel (Programmierung) – Wikipedia (translated)