Why does delphi do the mathematical “not” of an integer rather than the force to cast to a boolean value during a loop? Example
var myint:integer; ... myint:=1; while not myint=5 do begin myint:=myint+1; showmessage('myint now is : '+inttostr(myint)); end;
Your statement uses two operators: notand =. To understand how it is analyzed, you need to familiarize yourself with the operator's priority table .
not
=
Operators precedence ---------------------------- @ first (highest) not ---------------------------- * second / div mod and shl shr as ---------------------------- + third - or xor ---------------------------- = fourth (lowest) <> < > <= > = in is ----------------------------
, not , =. , :
(not myint) = 5
, , not .
, , , not:
not (myint = 5)
(myint = 5) , not .
(myint = 5)
, , . , , .
, , <>:
<>
myint <> 5
, Delphi , , not , . , . , , = (, , ).
delphi , , :
if not (myint = 5) then.... // vs if (not myint) = 5 then // vs if not myint = 5 then
, .
BTW: ( ) 3+4*5. , * +.
3+4*5
*
+
Source: https://habr.com/ru/post/1530919/More articles:Why segfault instead of privilege instruction error? - performanceReset Sleep Time - c ++Ошибка поврежденной памяти Kinect SDK - c#https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1530917/passing-numpy-string-format-arrays-to-fortran-using-f2py&usg=ALkJrhjL4iDEw8Wvyb__ohz7yFBdl_ISXAIs there a list of errors that will appear as "segfaults" if they are really not related to memory access? - assemblyHow to write integration holidays for asp.net web api - authenticationHow to make suitable size only for image in UIWebView? - htmlember.js with MySQL connection - mysqlError updating sdk - androidHow to set up Android development environment using STS, Android SDK, Maven and Spring Android - androidAll Articles