Method: CBool for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: CBool for VBS
Method: CBool for VBS
Converts an expression into the Variant type with the Boolean subtype.
vCBool = Object.CBool(expression)
| Object | VBS Object with this method. You do not need to specify this object. |
| expression | Variant Specifies any expression. |
| vCBool | Variant Receives the converted value. If the expression is 0, the method returns False, otherwise it returns True. |
The following example returns various Boolean expressions:
Dim MyNumA, MyNumB, MyNumC MyNumA = 4 MyNumB = 4 Call MsgBox(CBool(MyNumA = MyNumB)) ' Returns True MyNumC = 0 Call MsgBox(CBool(MyNumC)) ' Returns False