I have three pushbuttons where only one can be pushed at a time and want to set a variable for this. How? Basically I have three push buttons that correspond to pins 1 to 3 and want to set an efficient code that sets a certain variable into the index whose digitalRead is equal to one. Let us assume that only one button can be pressed at a time.
void loop()
    {
    if(digitalRead(1) == 1)                       
        {
        Variable = 1;            
        }
    if(digitalRead(2) == 1)                       
        {
        Variable = 2;              
        }
    if(digitalRead(3) == 1)                       
        {
        Variable = 3;  
        }
    }

Is there are more efficient way to do this, like for example using other loops?
I can't wrap around my head with doing this concept using the other loops such as for, do while, while and switch because the nature of the idea feels so unconventional for their uses.
If you can only have one button pushed at a time, you can only end up with at most one of the if statements evaluate to true. In your code, you check button 2 and 3, even if button 1 is pressed. Your code can be a bit faster if you do this:
if(digitalRead(1) == 1)                       
{
  Variable = 1;            
}
else if(digitalRead(2) == 1)                       
{
  Variable = 2;              
}
else if(digitalRead(3) == 1)                       
{
  Variable = 3;  
}