Showing test case FAILED if console log shows unmatching data

I have written script for verifying table values. If it matches, then print matching else not-matching. So, now when it is “not-matching”, test case passes.
I want that if any if condition is ''not-matching", then fail the test case entirely
How to get it?

Did you try…

import com.kms.katalon.core.util.KeywordUtil

if(...) {
  KeywordUtil.markFailed("This step failed because...")
}

Hi,
Thanks for your reply. It is working but what I want additionally is to get which or what data is not matching because here I have done AND-Or both in if statement:

if (((celltextrow == ‘MFP - Mono 151’) && (celltext == ‘151’)) ||
((celltextrow == ‘SFP - Mono 104’) && (celltext == ‘104’)) ||
((celltextrow == ‘MFP - Color 44’) && (celltext == ‘44’)) ||
((celltextrow == ‘SFP - Color 1’) && (celltext == ‘14’))) {
KeywordUtil.markFailed(“Step failed”)
println('Matching ')
}
else println(‘Not Matching’)