Problems with a 4051 multiplexer

Yes its a 4051 8 channel mux. As i said i wired i perfectly im using 2 buttons on channel 0 and 1. What im having trouble with is the actual code.
My question is - can someone tell me if i can read only from channel 0 and 1. do i use channel0, channel1 to do that?. Where should i put it (maybe between some lines is the right choice and not just at the bottom. if someone can explain me the void loop section and this section i would be very greatfull.

for(int bit = 0; bit < 3; bit++)
{
int pin = select[bit]; // the pin wired to the multiplexer select bit
int isBitSet = bitRead(channel, bit); // true if given bit set in channel
digitalWrite(pin, isBitSet);
}
return analogRead(analogPin);

Thank you