This function simply toggles the boolean value passed in. If 1 is passed in then 0 is returned. If 0 or "" is passed in then 1 is returned. It can be used to toggle the state of global variables that you may have set up as flags or preferences in your solution.
In this way you can reproduce the functionality of a checkbox button more elegantly by making the associated text clickable, like it is in the OS.
Create a global number field called Pref_ShowWelcomeScreenAtStartup and place it on a layout. Resize it to the size of a standard checkbox. Add a check box list to it which has a single value in it of 1. Add text on the layout next to the field to say "Show Welcome Screen at Startup". Select the field and the text and define a button that uses the script step SetField to place the value returned from Toggle(Pref_ShowWelcomeScreenAtStartup) into the field Pref_ShowWelcomeScreenAtStartup.