is there a function triggered by certain input voltage change?

hi; i know this is a very easy to answer question, but i couldnt find searching (you can look for the meaning of a word, but is difficult to find for a word with certain meaning).
the thing is that i need to know whether there it is a function that is triggered with certain pin pinput; at the same level as loop() and setup(). something like:

void Pin3High(){
}

or

void PIN3Change(){
}

would be cheaper in resourches than censing in the loop, an then changing a boolean value etc. Well, thinking on Attiny's
Thanks!

The ATmega328P has two external interrupt inputs on pins 2 and 3. You assign a function to them with the attachInterrupt() function.

http://arduino.cc/en/Reference/AttachInterrupt

i knew it was possible!
the solution looks complex but possible to my situation.
thank you!

Also every pin can trigger a "pin change interrupt". In addition it is possible to trigger interupts from the ADC. In doubt consult the datasheet :wink: