How to use IF Else statements in your code?

Im trying to perform a test where my script should be able to always select the first record available in a queue and if there is no record available, the tool should identify it as no record and somehow indicate in the result. Can this be incorporated through If-Else?
Please help.

It’s hard to follow what you’re trying to achieve. Does this help?

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

// ...

if(record_found) {
  // do something with the record
} else {
  KeywordUtil.markPassed("No record found")