interrupt/counter

so I need something like

void dimmerSwitch(){
dimmerCount++; }

if not could you give an example if you are able to? the arduino example doesnt quite fit for my application i dont think