problems with loops

Hello people! I am new to programming and I ask a strength.
I have a little problem in my code.
The idea of my code is to generate a list showing the strings of an array by means of a GUI.Label.

Example: I have an array which is as follows:

C #

public static List list = new
List ();

I inserted four values ​​in this array, thus;

list [0] = “Diego”;
list [1] = “Henrique”;
list [2] = “Pereira”;
list [3] = “Marinho”;

for me to print on the screen I used a for loop

OnGUI value () {

for (int i = 0; i <= list.Count -1; ++ i) {

Debug.log (Publicas.list );
GUI.Label (new Rect (lx * Screen.Width / 2,
(Screen.Height / 7) + i * ly * Screen.Height,
* Screen.Width lw, lh * Screen.Height)
Publicas.list text);
}
It wanted from printing only these four values ​​and stop. But it prints these four backlight values ​​and for printing them, printing them is infinitely;
Could anyone help me?
I thank your attention!
Below are the print of my code and the error that appears in the console
[30601-codigo1.jpg|30601]_
_
[30602-codigo2.jpg*|30602]*
_*
_*

It’s because the OnGUI function is called every single frame, so it depends, but let’s say you’re running at 30 frames per second. You are printing out the list of names 30 times each second. The way you’re doing the labels is correct, just don’t want to debug.log anything in the OnGui because it prints infinitely. If you want it to just print once and see what’s in there you can put that in the Start method.