How to Program in C# - Loops (E04)

preview_player
Показать описание
Let's learn how to repeat stuff using loops in C#!

Jason no longer offers the course mentioned in the video.

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

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

► All content by Brackeys is 100% free. We believe that education should be available for everyone.

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

♪ "ES_Dress Code_Black - oomiee" by Epidemic Sound
Рекомендации по теме
Комментарии
Автор

I am not at this level anymore but I wish somebody made videos with such a quality when I was a beginner and give them for free.

Good job !

pekame
Автор

For any aspiring programmers wanting an extra dose of iterations, there's also the do-while loop:

do
{
//repeating code here
} while ([condition]);

A critical difference is that a do-while loop checks the condition AFTER executing the repeating code rather than before. In practice, this means a do-while loop will always run at least once, whereas a while loop has the potential to not run at all.

MasterofGalaxies
Автор

That feeling of figuring out how to do the videos challenge alone feels pretty good, not gonna lie. Thanks Brackeys for another amazing video. <3

lambwastaken
Автор

Me: *checks out link for game dev mastery course* this will help me!
Also me: *sees price tag* maybe ill try streaming.

relixgames
Автор

This is the first time i'm happy of having homework.

ramiroabrego
Автор

for (int i = 0, i < Math.Infinity, i++) {
MakeAnotherTutorial();
}

testa
Автор

I saw a lot of tutorials but none was like yours
Everything was very clear
Now i can make my own calculator

rehaanak
Автор

I paused around 17:16, tried to do the exercise based on the information in the video, set up the other roll as a variable, was confused that the rolls ended before I could even press enter, then I changed the value of the second roll to a different number and it worked!

As someone in the comments explained, the first value assigned to the roll variable is just a placeholder until the numberGen does the randomizing. It felt really good to piece that together through working code, the comments, and the solution on Brackeys website! May these tutorials be equally useful to everyone else who finds them in the future.

minecraftaddictXD
Автор

Im a very experienced coder and ive been using for loops for so long this entire time without actually knowing what the code meant so even for advanced people simple videos like this can still help, thanks brackeys!

yungmaz
Автор

In just under 2 days, I've learnt so much more than my secondary school teacher could teach in the one-half term, I'm amazed at your work!

glowingsparksofficial
Автор

I just started learning to code and with these tutorials I’ve have made a few text based games

jamham
Автор

I love your energy in these videos, it makes tutorial and whole programming look so easy and fun, and it immediately puts a smile on my face :DD

kamilakaminska
Автор

I've been a professional GameDev and Software Developer for years now... I really hoped, starting up, for some content like this... It's just pretty heartwarming to see. Congrats on the amazing content.

richarddoci
Автор

I came into this course a complete beginner. I enjoy it when i get things right, but of course there are times when I get something wrong and I am not sure why. Luckily I have managed to find solutions to all my mistakes. I am excited to see how this course leads on to other more advanced courses, and how the contents of these courses integrate with developing games on Unity. The guy who teaches this course is an incredibly good instructor.

CB-sfmx
Автор

I just started learning C#, I taught myself VBA a few years ago and wanted to see if I could learn other languages. These videos are really well put together and easy to follow.

For the exercise you gave at the end of the video, I created a lottery simulator. I had a user select 6 numbers from 1 to 49. If the user selected a number < 1, or > 49, or if they selected a number they had already picked I output a message telling the user it was invalid and to select again.

Once the user selected 6 valid numbers, I rolled 6 dice (1-49) but I rerolled any dice that ended up with the same result as a previous dice roll. I then checked to see how many of the "dice rolls" matched the user's picks. If the user didn't match 6/6 I repeated the process.

I figured out how to update a line of text without adding a new line of text, so on my line of text I could see the number of attempts go up to the millions and I even included a line of text to show my matches found. When I finally hit 6 matches I had the console print out the results from the dice roll to make sure dice rolls matched my picks.

It was a fun project, I've coded something similar using VBA but VBA always crashed before I could actually see the results of my simulation. I'm amazed at how fast C# can run through the loops. Thank you so much for these videos!

LOLProjectSYD
Автор

i'm really loving this series, pls bring more.

mr.canelinhas
Автор

Felt overwhelmed watching 5 ep in 1 day! haha! Am a new subscriber :)

TitoPopoy
Автор

"To raise two to the power of two, we use the math class."
Okay now you sound like my sarcastic mom...

blenderman
Автор

Him repeating his first line was comedic genius lol! Awesome video man!

Akiga_games
Автор

I managed the challenge on my own, but couldnt figure out why it was telling me it took 0 throws to roll two of a kind every time.
Checked the forum, and it seems its doing that because if I set both variables to 0, its 2 of a kind from the start! So, I have to set one of the variables to a different number, then it works perfectly. I think Im getting the hang of this...

andymcdonald