Change the type of function in the arduino iot cloud

Hello guys, I have some doubts about working with the dashboard in Arduino IoT Cloud. I would like to add a Switch button in the dashboard like the figure below.
After adding the switch, arduino iot cloud will generate some code automatically in the sketch. As in below. However, It is a void function. I would like to use this switch to return some value to the main function. So it works like ....when I turn on the switch, it will return a value "1" to a variable in the main function. When it is turned off, it will return "0" to the variable in my main function.
auto generate sketch
I find it a bit challenging as the function has aldy been predefined in the thingProperties.h file. like below.

Is there any way I can change the type of the function(form void to int)? As I know the void type of function does not allow me to return a value to the main function. Any good suggestion or idea from you guys?