Should VerifyMatch work within if-else statements?

Will VerifyMatch work for a conditional if-else statement?
In my script if verifyMatch returns false I would like the control to go to the else part of the statement.
Something like the following:

str1 = ‘Sara’
str2 = ‘Sarah’

if (WebUI.verifyMatch(str1, str2, false)) {
println(‘Name matched’)
else {
println(‘Name not matched’)

If the 'if’condition is false control does not go to the ‘else’ part. The scripts fails.
How can I accomplish the else part?

Thanks for your help


Why don’t you simply use if (str1 == str2) for your use case?
Verify keywords are designed to throw exceptions (and by default stop the execution unless overide by failure handling)

Yes that simple solution worked :slightly_smiling_face: I was so bent on learning and using VerifyMatch for this.Thanks!