7. How to program in C# – WHILE LOOPS – Beginner Tutorial

35
3



In this video we take a look at how while loops work and how to use them to solve problems.

● Developer Forum:

Difficulty of lesson: Novice.

····················································································

Want to make powerful games, Windows and Mac software or mobile applications? Then this course is a great place to start.

····················································································

Donate:
Subscribe:

● Website:
● Facebook:
● Twitter:

········································­­·······································­·­····

► All content by Brackeys is 100% free. I believe that education should be freely available to everyone. Want to support me in my mission?
Donate here:

········································­­·······································­·­····

♪ Baby Plays Electro Games

Nguồn:https://wijstaanvooronzegrondrechten.org/

Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe

35 COMMENTS

  1. I wanted to just start i at 0 and add 2 every time, but that would've been too easy and probably not the intended solution, since it didn't need the % 2 thing. I like to put a variable for everything I can because thats what I did when I tried to learn c++. Also, I thought that the ++ thing was a c++ thing only because it was on the name.

    using System;

    class MainClass

    {

    public static void Main (string[] args)

    {

    for (int i = 1; i <= 100; i+= 1)

    {

    int remainder = i % 2;

    if (remainder == 0)

    {

    Console.WriteLine(i);

    }

    }

    Console.ReadKey();

    }

    }

  2. Hello i will like to ask is it sensible to have a while nested loop print out pyramid * pattern as i struggle to understand a for loop as a beginner programmer.

  3. Hello I'm wondering if anybody's having the same problem I can get into the forum???

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/brackeys.com/forum/wp-includes/taxonomy.php on line 3137

    I'm getting this error

  4. rip tom…

    Tom threw: 5

    Tom threw: 2

    Tom threw: 5

    Tom threw: 5

    Tom threw: 5

    Tom threw: 1

    Tom threw: 5

    Tom threw: 1

    Tom threw: 3

    Tom threw: 2

    Tom threw: 4

    Tom threw: 5

    Tom threw: 1

    Tom threw: 4

    Tom threw: 4

    Tom threw: 4

    Tom threw: 1

    Tom threw: 5

    Tom threw: 4

    Tom threw: 5

    Tom threw: 4

    Tom threw: 3

    Tom threw: 1

    Tom threw: 3

    Tom threw: 5

    Tom threw: 2

    Tom threw: 2

    Tom threw: 2

    Tom threw: 4

    Tom threw: 2

    Tom threw: 3

    Tom threw: 6

    It took tom 32 to throw a 6.

  5. As an extra little challenge, watch this video by The Coding Train { https://www.youtube.com/watch?v=h4ApLHe8tbk } then try to make the same program as in this video but in a for-loop. From doing this I learned a better understanding of while and for-loops and how they are pretty much the same.

  6. Is there anything wrong with incrementing by 2 to get even numbers?
    for (int i = 0; i < 100; i = i+2)
    {
    Console.WriteLine(i);
    }

  7. We learned with pascal in years 10 and 11 and now I want to learn c#, so I'm just here to learn how these mechanics work in here. But at least in these 2 years our teacher managed to teach even the lowest how to create a recursive function…

  8. When i write this code my numbers are not in rows, mine prints out straight up and down. But its identical to what Brackey has typed here…..

  9. in my case of the previous homework , i had to press space twice to get the number . The even numbers didn't just pop up xD ! Btw is do while loop sorta like the combo of if/else statements and for loop ?

  10. So what's the difference between While and For Loops? I mean, it's almost the same function? When do we use "for" and when do we use while loop?

LEAVE A REPLY

Please enter your comment!
Please enter your name here