Is it possible to check if device is connected to the IoT Cloud in code

I'm using an led in a project that i would like to turn on once it is connected to the Arduino IoT cloud. Is there a command or something that I could use that returns a true or false, for example I would use something like if(isConnected())... if possible

See post #9 HERE

HTH?

Thank you. This was the exact post I was looking for.