Zebra0.com

csharp loops


Text of video
private void Form1_Load(object sender, EventArgs e) { //Add numbers 1, 2, 3 to list box using while loop: lstNumbers.Items.Add("while"); int num = 1; while (num <4) { lstNumbers.Items.Add(num); num++; } lstNumbers.Items.Add("for"); for (int i=1; i<4; i++) { lstNumbers.Items.Add(i); } }

End of lesson, Next lesson: