Using a Result (true or false) of a command as variable

I want to store the true or false result from an application command as a variable

example:

tell apllication “x”
do something --Result will be true if the program could perform the command or false if there was a problem
end tell

is this possible? And how…

Thx,

Bram

How’s this?

tell application "x"
    try
        do something
        return true
        
    on error
        return false
    end try
end tell
tell application "x" to set booleanResultVariable to do something

Indeed StefanK that worked just fine. thx