Most of the programming languages converts false into 0 and true into 1. But VB6, Office VBA and VB.NET converts true into -1. Why does VB convert logical value like this?
Asked
Active
Viewed 59 times
0
stanchcorder6
- 99
- 5
-
4Because that is what it is documented to do. – GSerg Sep 10 '22 at 07:54
-
`true` is a non zero value. There is false (`0`) and non false (`<>0`). – Lundt Sep 10 '22 at 10:31
-
Also VBA only supports signed integers. `-1` = `&hFFFFFFFF` ie all bits are set in the number. But as I said above true is a non zero number. The CPU tests if it is `0` or not `0`. The computer has to convert what you type to a number. It chooses the same number as the Windows API. – Lundt Sep 10 '22 at 19:29