How to check if the state of a switch has been changed?

I don't want to check what the state of a switch is, instead I want to perform an action every time the switch is flipped regardless of its state.

Hello!,

The Arduino example "StateChangeDetection"(File>Examples>Digital>StateChangeDetection) will help you out a lot with this :).

-Englishscone

There is an example in the ‘Examples’ that come with the IDE.