Best way to create large amount of buttons

I am needing to create 15 buttons which are in 3 rows of 5. I have tried using a for loop but this does not work due to GUI.Buttons being in an if statement. How do you create buttons in a loop so I do not have to have a large amount of code for the buttons?

Just for all those people out there, if you put an if statement for a button in a for loop it pauses the loop because it is waiting for the true statement to be returned. Simply putting the if statement in the for loop does not work.

public class Buttons : MonoBehaviour {
void OnGUI(){
for( int i = 0; i < 15; ++i ) {
if( GUILayout.Button( "Click " + (i).ToString() ) ) {
Debug.Log( i );
}
}
}
}

I am pretty sure that this works.

you need to place the if statement inside the for loop so each time throu the loop it creats a button that can be pressed.