CBool() - Converts to Boolean Type - TestingQ.com

-->Exclusive Portal for Testing Jobs

CBool() - Converts to Boolean Type

CBool() - Converts to Boolean Type
Converts an expression to a Boolean type that is either True or False.
Boolean = CBool(Expression)
Returns True or False

Example 1
CBool(5) ’Returns True
CBool(0) ’Returns False
CBool(-5)
‘Returns True
A nonzero value returns True, zero returns False. A run-time error occurs if the expression can not be interpreted as a numeric value

Example 2
Result = CBool(1 + 1 = 5)  'Result is false
Result = CBool(1 + 1 = 2)  'Result is true

No comments:

Post a Comment