This is called a "logical short circuit assessment", a form of "lazy assessment".
You can tell the compiler to use or not use this function using the compiler directives :
Complete evaluation Lazy evaluation {$B+} {$B-} {$BOOLEVAL ON} {$BOOLEVAL OFF}
But note that this is not only optimization, as this function allows you to write code like
if (length(myarr) > 0) and (myarr[0] = MY_VAL) then
which will work even if myarr[0]
does not exist. This is actually quite common.
source share