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


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…



How’s this?

tell application "x"
        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