Counting pulses

something like a switch case thing like

val = digitalRead(pin)
switch (val)
{
case low:
break;
case high:
count += 1;
break;
}

EDIT: Or like not bad, with an actual if statement to associate low with 1 and high with 2, but this won't affect your code or slow anything down.