Has TRUE always had a non-zero value?

前端 未结 22 1007
予麋鹿
予麋鹿 2020-12-31 01:38

I have a co-worker that maintains that TRUE used to be defined as 0 and all other values were FALSE. I could swear that every language I\'ve worked with, if you could even

22条回答
  •  遥遥无期
    2020-12-31 01:52

    DOS and exit codes from applications generally use 0 to mean success and non-zero to mean failure of some type!

    DOS error codes are 0-255 and when tested using the 'errorlevel' syntax mean anything above or including the specified value, so the following matches 2 and above to the first goto, 1 to the second and 0 (success) to the final one!

    IF errorlevel 2 goto CRS
    IF errorlevel 1 goto DLR
    IF errorlevel 0 goto STR
    

提交回复
热议问题