Button with toggle effect

Hi. I add one button (b0) to my screen.
In touch press Event(0) I have
dim=25
Can you help me to add to this code option that when pressed again switch dim to 100, and press again to 25 - toggle switch
I need this code here not in Arduino.
Thx in advance

if(dim==25)
{
dim=100
}else
{
dim=25
}

Thank you very much. I will add it to my project.

In the button release event use the following:

if button.val==0
dim=100
else
dim=25

(add the appropriate formatting)