The variableisOKis declared but not initialized, so its value isnull. Theif-elseconditions check for specific values ofisOK(trueorfalse), but since it isnull, none of those conditions are satisfied. The program defaults to theelseblock, assigning4tox.
[Reference:Apex Developer Guide: Boolean Data Type, , ]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit