How to Program in C# - Loops (E04)

  Рет қаралды 504,195

Brackeys

Brackeys

Күн бұрын

Пікірлер: 1 000
@pekame
@pekame 4 жыл бұрын
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
@pekame 4 жыл бұрын
I really love the happy vibe your videos have, like a lot of tutorials (even paid ones) have a boring vibe to them which will also make you bored (probably because the teacher is bored or not excited at all)
@elsawhere8107
@elsawhere8107 4 жыл бұрын
I have some sort of nostalgy rewatching this as he made them in the past as well, when i was a complete beginner. I learned the syntax from him, but everything else was practice => error => fix the error
@smarty265
@smarty265 4 жыл бұрын
Youre right these tutorials are the best! Sucks that we have to wait 2 weeks for the next one :(
@lavrlevcat
@lavrlevcat 4 жыл бұрын
PeKame PeKame I have the same problem
@erglwrgl
@erglwrgl 4 жыл бұрын
exactly
@lambwastaken6581
@lambwastaken6581 4 жыл бұрын
That feeling of figuring out how to do the videos challenge alone feels pretty good, not gonna lie. Thanks Brackeys for another amazing video.
@kungjocke9446
@kungjocke9446 4 жыл бұрын
How did u do it? I'm completly lost here and the Brackeys website with the solutions seems to be down! ty
@MitruMesre
@MitruMesre 4 жыл бұрын
using System; namespace C__Projects { class Program { static void Main(string[] args) { //activate random numbers somehow Random numberGen = new Random(); int roll01 = 0; int roll02 = 1; int attempts = 0; Console.WriteLine("Press enter to roll the dice"); while(roll01 != roll02) { //Makes the program wait for you to press "enter" before rolling Console.ReadKey(); //Generates new numbers roll01 = numberGen.Next(1, 7); roll02 = numberGen.Next(1, 7); Console.WriteLine("Roll 1: " + roll01); Console.WriteLine("Roll 2: " + roll02); Console.WriteLine(); attempts++; } Console.WriteLine("It took you " + attempts + " attempts to roll two of a kind."); Console.ReadKey(); //Stops the program from instantly closing } } }
@MitruMesre
@MitruMesre 4 жыл бұрын
rolling it on your first try has a minor grammatical error on line 34 (1 attempts) that can be fixed with an if/else statement but I can't be bothered
@queZxXx
@queZxXx 4 жыл бұрын
Why is the int for the first roll 0 but for the second 1. When I made my attempt that was the only thing tht gave me problems.
@MitruMesre
@MitruMesre 4 жыл бұрын
@@queZxXx if I initialized them to the same value, the while loop would instantly close
@MasterofGalaxies4628
@MasterofGalaxies4628 2 жыл бұрын
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.
@Luquis_17
@Luquis_17 2 жыл бұрын
Thank You I will use it Take care
@Lutramere
@Lutramere 11 ай бұрын
Thanks! My code was having both "die" equal 0 to begin with, but the do loop fixed this. I also figured that simply setting them to different numbers would work, but this seems more efficient.
@PastCity
@PastCity 3 ай бұрын
Hi, 2 years later. Thank you for posting this! I actually got stuck on the challenge, I noticed that since roll1 and roll2 were both initially 0, the while loop detected that roll1 != roll2, before it was able to randomly re-assign them from 0 to a number from 1-6. It took me a minute, but I realized that since the value of 0 was going to be overwritten by a randomly generated number anyways, I could just give roll1 a value of 0, and roll2 a value of 1. This worked, and I completed the challenge. Afterwards, I saw your comment, and I tested it out myself to see if it would've fixed the issue, and I set both roll values to 0. It worked! So I took note of the syntax in my study book and I'll use it the next time I want it to check conditions AFTER code. Much appreciated! I love youtube comments.
@testa6121
@testa6121 4 жыл бұрын
for (int i = 0, i < Math.Infinity, i++) { MakeAnotherTutorial(); }
@Jxhsxn
@Jxhsxn 4 жыл бұрын
Very funny dude...
@sps014
@sps014 4 жыл бұрын
Replace comma , with semicolon ;
@RakoGamesOfficial
@RakoGamesOfficial 4 жыл бұрын
fix: void Start() { for (int i =0; i
@sps014
@sps014 4 жыл бұрын
@@RakoGamesOfficial @Rako Games replace Public with public and Void with void .... Edit : C# is case sensitive
@RakoGamesOfficial
@RakoGamesOfficial 4 жыл бұрын
@@sps014 oh yea.... I forgot that
@minecraftaddictXD
@minecraftaddictXD 2 жыл бұрын
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.
@newkie1626
@newkie1626 11 ай бұрын
Yep, was stumped for a bit, looked through my code and realised that it was probably determining the placeholder 0s as doubles. I suppose another option could be to have a do while loop (learnt from another commenter) which checks it after running, rather than before.
@vildrox019
@vildrox019 8 ай бұрын
I had the same thing happen to me just now. I'm glad that many users share their issues and solutions as you have. It's very helpful to us newbies, so I thank you. I'm upset to find that Brackeys has decided to stop making content, but he left so much information for us to absorb, and for that I'll be ever grateful.
@kamilakaminska1347
@kamilakaminska1347 4 жыл бұрын
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
@s--b
@s--b 4 жыл бұрын
exactly he’s like your favorite teacher at school, literally always smiling
@relixgames9425
@relixgames9425 4 жыл бұрын
Me: *checks out link for game dev mastery course* this will help me! Also me: *sees price tag* maybe ill try streaming.
@kristapskrumins5676
@kristapskrumins5676 3 жыл бұрын
i am the evil man who changed the like number from 69 to 70
@cbaweja08
@cbaweja08 3 жыл бұрын
@@kristapskrumins5676 YOU MONSTER
@sidelymations7617
@sidelymations7617 3 жыл бұрын
@@kristapskrumins5676 u unholy entity how do i say nice now. if it gets to 420, do not change lmao
@unlxck3255
@unlxck3255 3 жыл бұрын
@@sidelymations7617 nobody listened
@sidelymations7617
@sidelymations7617 3 жыл бұрын
@@unlxck3255 the problen with society (its a joke dont sue me)
@rehaanak4052
@rehaanak4052 4 жыл бұрын
I saw a lot of tutorials but none was like yours Everything was very clear Now i can make my own calculator
@Martinez-p5b
@Martinez-p5b 3 жыл бұрын
we are on the same wavelength my friend
@extro2298
@extro2298 Жыл бұрын
thats what im doin too, it was so easy thanks to these videos
@Yami_no_senshi
@Yami_no_senshi Жыл бұрын
loop becoming a little difficult for me through i made a calculator
@yungmaz13
@yungmaz13 4 жыл бұрын
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!
@reawy14
@reawy14 10 ай бұрын
Hey! could you please tell me why do we put i++ in?
@yungmaz13
@yungmaz13 10 ай бұрын
@@reawy14 i++ is the incrementation, incrementation in code is when you add to something, for example if I increment x by 2 then that means im adding 2 to x i++ means you add 1 to i, its the same as doing i+=1 or i=i+1, i is your counter in a for loop so basically on each iteration you’re increasing/ incrementing the counter Starting with i=1 i++ i is now 2 i++ i is now 3 If you want to count backwards you can even do i- which is equivalent to i-=1 or i=i-1
@yungmaz13
@yungmaz13 10 ай бұрын
@@reawy14 Let me know if you don’t understand
@reawy14
@reawy14 10 ай бұрын
Thanks lol didnt think you were going to respond
@glowingsparksofficial
@glowingsparksofficial 3 жыл бұрын
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!
@swordeyeman2884
@swordeyeman2884 Жыл бұрын
So true
@ramiroabrego9382
@ramiroabrego9382 4 жыл бұрын
This is the first time i'm happy of having homework.
@phoenixsp7
@phoenixsp7 3 жыл бұрын
same
@BarredTitan
@BarredTitan 3 жыл бұрын
same
@arcweeb1619
@arcweeb1619 3 жыл бұрын
same
@foggyforest2625
@foggyforest2625 3 жыл бұрын
SO TRUE!!!
@ethanvr7961
@ethanvr7961 3 жыл бұрын
Same. its because, you are getting to work on something you like instead of working on things that bore you.
@David-vz4yk
@David-vz4yk 4 жыл бұрын
Can’t wait for the game jam!
@birdyhere2085
@birdyhere2085 4 жыл бұрын
Lol im also in the jam im using python to make it😄
@David-vz4yk
@David-vz4yk 4 жыл бұрын
Birdmation dang, good luck!
@birdyhere2085
@birdyhere2085 4 жыл бұрын
@@David-vz4yk thx
@birdyhere2085
@birdyhere2085 4 жыл бұрын
@Drachma86 this is my first ever jam😁
@birdyhere2085
@birdyhere2085 4 жыл бұрын
@Drachma86 thx man!
@jamham4820
@jamham4820 4 жыл бұрын
I just started learning to code and with these tutorials I’ve have made a few text based games
@daddyicee4216
@daddyicee4216 3 жыл бұрын
How are you doing now
@CB-sf9mx
@CB-sf9mx 2 жыл бұрын
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.
@richarddoci
@richarddoci 4 жыл бұрын
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.
@LOLProjectSYD
@LOLProjectSYD 2 жыл бұрын
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!
@TitoPopoy
@TitoPopoy 4 жыл бұрын
Felt overwhelmed watching 5 ep in 1 day! haha! Am a new subscriber :)
@crxe7251
@crxe7251 4 жыл бұрын
This dude tough me a lot! He has the best free tutorials out there. With his help, I started my gaming company and made a game that downloaded more than 45M. So appreciated!!!
@khaidirm5820
@khaidirm5820 4 жыл бұрын
really??! :D, what's the game? and how long is the company been going?
@crxe7251
@crxe7251 4 жыл бұрын
Khaidir M the game is draw car 3D and it went insane! :p
@crxe7251
@crxe7251 4 жыл бұрын
Khaidir M and I left the company yo become KZbinr lolll
@icedchqi
@icedchqi 4 жыл бұрын
@@crxe7251 so you started voodoo?
@crxe7251
@crxe7251 4 жыл бұрын
Icedchai plays no they published our game. We are fabrika games. I explained everything on my first video check it out!
@mr.canelinhas498
@mr.canelinhas498 4 жыл бұрын
i'm really loving this series, pls bring more.
@nickg2759
@nickg2759 4 жыл бұрын
i usually code in js or c++ but just have so much respect for people like this sharing little known knowledge in a fun and interesting way
@WBT-p9b
@WBT-p9b 4 жыл бұрын
Thank you Brackeys! You guys are Always giving out amazing free resources that many of us need. You're great! 💖
@saadtachrimant9704
@saadtachrimant9704 4 жыл бұрын
I know how to programme consoles programmes in C#, but the way that you explain this makes it so special, i just can't wait to became a supporter...
@wenjiatang4029
@wenjiatang4029 3 жыл бұрын
Thanks so much for these amazing tutorials that are *actually* beginner-friendly!
@Anmol_Oberoi
@Anmol_Oberoi 4 жыл бұрын
Hello Sir, I am from India , and i have made my first Game and i want Congratulate you for that because you are the one whose Videos and tutorials helped me in making my first game successfuly Thank You so Much for that.i will never miss a chance to meet you if will get one.
@andymcdonald7760
@andymcdonald7760 2 жыл бұрын
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...
@nihadceferzade8981
@nihadceferzade8981 Жыл бұрын
Console.WriteLine("Estimate a random number within the interval [1;25]"); int a=1; while (a>0) { int x; x = Convert.ToInt16(Console.ReadLine()); if ((x >= 1) && (x
@IdOnThAvEaUsE69
@IdOnThAvEaUsE69 Жыл бұрын
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { Random numberGen = new Random(); int roll1 = 0; int roll2 = 0; int roll3 = 0; int attempts = 0; Console.WriteLine("Press enter to roll the dice."); while (roll1 != roll2 || roll1 != roll3 || roll1 == 0) { Console.ReadKey(); roll1 = numberGen.Next(1, 7); roll2 = numberGen.Next(1, 7); roll3 = numberGen.Next(1, 7); Console.WriteLine(" You rolled " + roll1 + ", " + roll2 + " and " + roll3 + "!"); attempts++; } Console.WriteLine("It took you " + attempts + " attempts to roll a triple... Fascinating."); string input = ""; while(input.ToLower() != "exit" && input.ToLower() != "quit") { Console.WriteLine("Please type 'exit' or 'quit' to exit the program."); input = Console.ReadLine(); } } } } I've done this. ChatGPT sure is helpful AF.
@deuslra3088
@deuslra3088 2 ай бұрын
@@nihadceferzade8981 bes videodaki şeylernen heç elaqesi yoxdu axı bunun qaqaş D:
@davidbudularu3468
@davidbudularu3468 4 жыл бұрын
I am so happy that this series exists for free
@KellySampsonKnK
@KellySampsonKnK 4 жыл бұрын
if you initialize the two rolls as zero in the beginning. The game would end instantly because the match. To fix this i had to set my second roll as random at the start. static void Main(string[] args) { Random numgerGen = new Random(); int roll = 0; int roll2 = numgerGen.Next(1,7); int attempts = 0; Console.WriteLine("Press a key to roll the dice."); while (roll != roll2){ Console.ReadKey(); roll = numgerGen.Next(1,7); roll2 = numgerGen.Next(1,7); Console.WriteLine(" Dice 1 You rolled: " + roll); Console.WriteLine(" Dice 2 You rolled: " + roll2); attempts ++; } Console.WriteLine("It took you "+ attempts+" attempts to match"); Console.ReadKey();
@Aerionix1
@Aerionix1 3 жыл бұрын
I almost did the same, but we were overthinking it. A new random isn't required. Just have roll = 0 and roll2 = 1. They're no longer the same so the loop starts, and since that initial value is just a placeholder, it doesn't affect anything that happens during the loop.
@tyde_8002
@tyde_8002 2 жыл бұрын
@@Aerionix1 Thank you both so much! I was trying to figure this out and was confused on why it kept ending before I could roll.
@mukogen6432
@mukogen6432 2 жыл бұрын
Thank you man am stuck at it
@KodQuickshot
@KodQuickshot 2 жыл бұрын
@@Aerionix1 8
@the_game1259
@the_game1259 2 жыл бұрын
OMG THANKS I HAD N CLUE WHAT WAS GOING ON LMAO
@vaskrol
@vaskrol 4 жыл бұрын
Thank you for alternating videos and not posting only videos for newbies in a row.
@emirbouakili2709
@emirbouakili2709 4 жыл бұрын
I added my own thing to the first part of this tutorial where instead you can only add how many numbers you wanted you can also add how much you wanna go up in: //Text for console Console.WriteLine("How many number/s you want: "); int count = Convert.ToInt32(Console.ReadLine()); //Reads first value for how many sets of numbers you want Console.WriteLine("How much you wanna go up in: "); int valup = Convert.ToInt32(Console.ReadLine()); //Reads second value for how much u wanna go up in numbers //Loop for (int i = 0; i < count; i++) //Adds the value that the user has put in for the amount of number/s { double result = Math.Pow(valup, i); //Goes up in the value that user puts in Console.WriteLine(result); //Console writes result } (Sorry for the bad explanation I just normally keep these to myself)
@jstdanny
@jstdanny 3 жыл бұрын
I just started coding a few days ago and now I was able to create a coin flipper just from your tutorials!
@Adweale
@Adweale 4 жыл бұрын
Don't mind me, just using this for notes. Random numGen = new Random(); int roll01 = 0; int roll02 = 1; int attempts = 0; Console.WriteLine("Press enter to roll dice."); while (roll01 != roll02) { Console.ReadKey(); roll01 = numGen.Next(1, 7); roll02 = numGen.Next(1, 7); Console.WriteLine("Roll 1: " + roll01); Console.WriteLine("Roll 2: " + roll02); Console.WriteLine(""); attempts++; } Console.WriteLine("It took you " + attempts + " attempts to roll two of a kind."); Console.ReadKey(); } } }
@Adweale
@Adweale 4 жыл бұрын
@Rudraksha Dwivedi?
@Adweale
@Adweale 4 жыл бұрын
@Rudraksha Dwivedi Lol
@zachabsher8546
@zachabsher8546 4 жыл бұрын
I just started and finished these videos 3 days ago and my friend in college is impressed lmao cant wait for the next video
@blenderman1541
@blenderman1541 3 жыл бұрын
"To raise two to the power of two, we use the math class." Okay now you sound like my sarcastic mom...
@slowmaniatrickshots959
@slowmaniatrickshots959 2 жыл бұрын
Iv done one of these tutorials plus the challenge every day for the last 4 days and I love doing it im sad you quit KZbin and I know im really late to the channel but seriously really appreciate it
@omerfarukbykl6097
@omerfarukbykl6097 4 жыл бұрын
It took me 38 attempts to roll a six. ...
@MichaelKeaveneyYouTube
@MichaelKeaveneyYouTube 4 жыл бұрын
Took me 2, lmao.
@animationspace8550
@animationspace8550 4 жыл бұрын
probability means what is likely not what wull happen
@shablam0
@shablam0 4 жыл бұрын
For me it only took me one attempt like 3 times in a row and I was trying to figure out why my code was broken. Turns out I was just absurdly lucky.
@gandeldalf
@gandeldalf 4 жыл бұрын
For me it took 27 attempts lmao
@tornanblade665
@tornanblade665 4 жыл бұрын
poor guy
@pranaypatil1969
@pranaypatil1969 4 жыл бұрын
i am literally watching your playlist on this tutorial at 2 am and i was happy u made a 5th video.......keep posting
@nzack7888
@nzack7888 3 жыл бұрын
uhhhhh
@oranjevis
@oranjevis 4 жыл бұрын
thanks i waited the whole day on this video
@pantbill8739
@pantbill8739 4 жыл бұрын
I'm a beginner and you help a lot THANKS! Good Job !!
@legelf
@legelf Жыл бұрын
when u learn more in a 15mins yt video than a 4hours uni lecture 💀
@Akiga_games
@Akiga_games 3 ай бұрын
Him repeating his first line was comedic genius lol! Awesome video man!
@JamateSirajiaFaisalabad
@JamateSirajiaFaisalabad 4 жыл бұрын
While( learning == C# ) ( Console.WriteLine("Keep Watching Brackeys"); }
@nonEuclideanExplosive
@nonEuclideanExplosive 2 жыл бұрын
using system; namespace brackeys_comment { class learning { public string learning; } class program { static void Main(string[] args) { if (learning >= 1) { Console.WriteLine("keep watching brackeys!") Console.WriteLine("I think that is what you meant, may be wrong") Console.ReadKey(); } else { Console.WriteLine("damn, brackeys is nice"); Console.ReadLine(); } } } }
@indiespace7727
@indiespace7727 4 жыл бұрын
Thanks so much for all the tutorials you make. Your enthusiasm and knowledge really make a great environment for learning.
@karrotkake7203
@karrotkake7203 4 жыл бұрын
You should make a montage of you saying "And, if we RUN this now.."
@GamingWizardYT
@GamingWizardYT 4 жыл бұрын
Can we all agree that Brackeys is the best YT game dev to ever live. You inspired me to post a video in which I give my personal opinions with what are the best tips for beginner devs. If you have some spare time it would be really cool if you checked that out and critique my ideas!
@mansodev
@mansodev 4 жыл бұрын
Thanks brackeys for the tutorials, they’re great, I know java and lua and I wanted to learn c#. Java is quite similar to c#.
@Bigbadpoppaj
@Bigbadpoppaj 4 жыл бұрын
C++ as well
@shilplays3787
@shilplays3787 4 жыл бұрын
this is helping me so much, i'm struggling to understand code and your tutorials are amazing!
@SigilWizardClassic
@SigilWizardClassic 4 жыл бұрын
I think I had a bowl of For Loops for breakfast this morning...
@zntei2374
@zntei2374 4 жыл бұрын
if (BowlDropped) break;
@merowareinstance
@merowareinstance 4 жыл бұрын
@@zntei2374 I laughed way too loud on this one. LMAO
@erglwrgl
@erglwrgl 4 жыл бұрын
LOL
@erglwrgl
@erglwrgl 4 жыл бұрын
@Saad Syed lol
@icedchqi
@icedchqi 4 жыл бұрын
@@zntei2374 if (bowlDropped) { verbal.scream; } else { happy = true; }
@smartandfunny6140
@smartandfunny6140 4 жыл бұрын
I've been a developer for 13 years and I Don't know why I watched this : )
@merowareinstance
@merowareinstance 4 жыл бұрын
Because it's entertaining, the graphics are fun to watch, and the comments are hilarious
@mr.dingleberry4882
@mr.dingleberry4882 4 жыл бұрын
Do you work full time? And are you a solo game dev or you work in a team?
@khaidirm5820
@khaidirm5820 4 жыл бұрын
@@mr.dingleberry4882 he said "a developer" not "a game developer"
@boggeshzahim3713
@boggeshzahim3713 4 жыл бұрын
@@mr.dingleberry4882 I'd guess that most developers aren't game developers and don't work solo, its much easier to make a living by working for a business instead of trying to create a business yourself.
@skylycan007
@skylycan007 2 жыл бұрын
this was the best "while" simple explanation that i've ever watched! thanks!
@RipperRooX
@RipperRooX 4 жыл бұрын
Guys, REALLY check out Jason Weimanns tutorials. He is absolutley awesome.
@GaithTalahmeh
@GaithTalahmeh 4 жыл бұрын
Dude I don't have a 1000$ for my own living, how will i spend it on his tutorials
@RipperRooX
@RipperRooX 4 жыл бұрын
@@GaithTalahmeh He also has a youtube Channel in which he teaches a lot! Check that out, his programming style is super clean. i dont wanna advertise another channel in brackeys channel so no link. The 1000$ offer is for people who wanna get really serious and can afford it, but it also offers a lot of things it's not like a 3 part youtube series and then you're done. I can't tell much about the 1000$ Course and what all is included, cause i also only know his youtube tutorials, but if i would become professional and could afford it, then i'd take that course cause his coding style is really nice.
@GaithTalahmeh
@GaithTalahmeh 4 жыл бұрын
@@RipperRooX Thx for the info, Ill check him out l8r , Thx 😁😁
@monkeyjosh
@monkeyjosh 4 жыл бұрын
Hell yeah, I'm learning c# at uni but it's much more entertaining watching these and ignoring my lectures
@Unknown_Programmer
@Unknown_Programmer 4 жыл бұрын
I don't know why I am watching this even if I know these already
@ducanhchu5731
@ducanhchu5731 2 жыл бұрын
I learned this after GMTK game jam, theme is roll of the dice, absolutely choose the right course.
@tigowesterkamp3315
@tigowesterkamp3315 4 жыл бұрын
Can you sometime show how to use these information to make an actual game? It would be great! These vids are great btw keep on goin!
@OneMorbToMorbThemAll
@OneMorbToMorbThemAll 3 жыл бұрын
lmao, i thought way to hard on this homework, when in reality it was so obvious. Man ur the best!
@NellTheBean
@NellTheBean 4 жыл бұрын
1 minute ago 6 views 32 likes and 9 ocmments... YEAH THAT MAKES SENSE
@PDCMYTC
@PDCMYTC 4 жыл бұрын
Don't read my name*
@space_junkie9414
@space_junkie9414 2 жыл бұрын
i was able to understand the basic principals of loops because of you thank you very cool!
@erglwrgl
@erglwrgl 4 жыл бұрын
Eating For Loops in the morning always make me Console.Beep;
@jovem3767
@jovem3767 3 жыл бұрын
Console.Beep();
@Mik-kv8xx
@Mik-kv8xx 3 жыл бұрын
Instead of doing your challenge I decided to make a realistic projectile simulation and it was painful but it works!
@divaysud4487
@divaysud4487 3 жыл бұрын
using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Green; Console.Title = "While Loops"; //while loops they are also a type of loops just like for loop they also repeat code. //while loops syntax is: //while (here we write the condition) //{ //Here what the while loops has to execute if the condition is true or false. //} Random numberGen = new Random(); //Here we are making a number generator that will generate any number. //Here random is a class that creates random numbers numberGen is like a variable that stores //the random numbers and the new makes a new random number after another. //This how this Random numberGen = new Random(); works. //numberGen.Next(1, 7); //Here we are using numberGen as a variable and the next class is letting us choose the minimum and the maximum values that would be generated. double roll1 = 0; double roll2 = 1; double attempts = 0; Console.WriteLine("Press enter to roll the dice."); while(roll1 != roll2) { Console.ReadKey(); roll1 = numberGen.Next(1, 7); roll2 = numberGen.Next(1, 7); Console.WriteLine("You rolled a: " + roll1 + " on first dice."); Console.WriteLine("You rolled a: " + roll2 + " on second dice. "); attempts++; } Console.WriteLine("You took: " + attempts + " attempts to roll a same number."); //while (roll != 6) //{ // Console.ReadKey(); // //Here we are adding this so that whenever the user press enter the dice would roll till it's a six. // roll = numberGen.Next(1, 7); // //Here we are using numberGen as a variable and the next class is letting us choose the minimum and the maximum values that would be generated. // Console.WriteLine("You rolled a: " + roll); // //As roll is constantly changing so as soon as roll is equal to 6 it would exit the program. // attempts++; // //The attempts would be adding up as many times as it takes us to roll a six. //} //Console.WriteLine("It took you: " + attempts + " turns to roll a six."); ////Displaying the attempts the user took to roll a six. Console.ReadKey(); } } } (P.S: It took me thirty minutes to figure out that i had to change roll2 to 1 from 0. If I do not do that then they would be already equal.)
@abdurrafaydanyal
@abdurrafaydanyal 2 жыл бұрын
thanks for saving my 25 mins :)
@abhinabdoley6451
@abhinabdoley6451 2 жыл бұрын
just a question what do i roll two roll1 values eg roll 1:2 roll 2:4
@allenshelly7836
@allenshelly7836 Жыл бұрын
or you could use the following. using System; public class HelloWorld { public static void Main(string[] args) { Random NumberGen = new Random(); int Roll1=0; int Roll2=0; int Attempts=0; Console.WriteLine("Pres Enter to Roll:"); do { Console.ReadKey(); Roll1 = NumberGen.Next(1,7); Roll2 = NumberGen.Next(1,7); Console.WriteLine("Roll 1 : "+ Roll1); Console.WriteLine("Roll 2 : "+ Roll2); Attempts++; }while (Roll1 != Roll2); Console.WriteLine(" Total No of Attempts = "+ Attempts); Console.ReadKey(); } }
@badelmo7021
@badelmo7021 4 жыл бұрын
This is amazing and exactly the motivation i needed, thanks for this series please keep it up!
@yoyo12345
@yoyo12345 4 жыл бұрын
Still dreaming about a pc!😂😂
@empty-v2t
@empty-v2t 3 жыл бұрын
Personally i hate homework but i can do this all day! And i love your videos very helpfull and easy to understand !!
@zazadude
@zazadude 4 жыл бұрын
can i use the loops with boolians? like: while (isJamesEating = true)
@dermakol8543
@dermakol8543 4 жыл бұрын
Yeah, actually any expression you put in there evaluates to bool (6 == 6 evaluates to true and so on) That means you do not have to compare the bool, just use "while(isJamesEating)"
@zazadude
@zazadude 4 жыл бұрын
@@dermakol8543 cool! thanks!
@boggeshzahim3713
@boggeshzahim3713 4 жыл бұрын
Dermakol already answered but I wanted to add that while loops are always using booleans. If you think about how you would describe the work your loop is doing in English you can see this: loop while james is eating, loop while your list is not empty, loop while the path is not clear. As you can see all of these are either true or false statements, aka Booleans. Hope that makes sense.
@thedude4039
@thedude4039 4 жыл бұрын
no need to say isJamesEating = true, just say isJamesEating. This would work, but make sure that the loop does something that will eventually make isJamesEating equal to false. If you don't, the loop will go on forever, which will freeze up your program and make it crash!
@namitaghorpade6306
@namitaghorpade6306 4 жыл бұрын
Brackey your great game dev teacher
@johnes2337
@johnes2337 4 жыл бұрын
Something that YandereDev doesn't know how to use.
@seireiart
@seireiart 4 жыл бұрын
I was expecting this comment already LMAO 🤣🤣🤣
@afigamming7958
@afigamming7958 4 жыл бұрын
The joke is overused i laughed anyway but thats not inoortant its still overused
@puedoiralbanoporfavor854
@puedoiralbanoporfavor854 4 жыл бұрын
Yea i watched a video on the terrible coding in that game and i actually understood a lot of it
@SADDE
@SADDE 4 жыл бұрын
> using if else instead of switch 🤮
@vIaad
@vIaad 4 жыл бұрын
Actually, sometimes is better to use else if than switch...
@invictine
@invictine 3 жыл бұрын
Dammn, the amount of big brain I felt after I completed the (sort of] homework in less than a minute is unexpressionable in words.
@seireiart
@seireiart 4 жыл бұрын
So that's where YandereDev stops learning. Since he doesn't need loops for his game lol
@rikuzariyuzu2815
@rikuzariyuzu2815 3 жыл бұрын
it took me so long to finish the challenge,it feels great to finish it
@skilfuleric
@skilfuleric 2 жыл бұрын
how did u finish it im stuck on the pairs how to i make the whole loop close on pairs instead of just a 6
@GreatFall
@GreatFall 4 жыл бұрын
-don’t know how to code -don’t have unity -don’t know what he is talking about What am I doing with my life
@blackyonbi
@blackyonbi 4 жыл бұрын
Trust me, Im also a beginner and for a few months I couldn fathom what the fuck was he ( or any other tutorial). However , something that worked for me ( and maybe It could or couldnt work for you) is that just copy step by step what he does, dont watch the whole video, pause the video, repeat exactly what they do, go back if you need to until youre absolutely sure that youre doing what they are doing. Then look at the code and " explain" to yourself what anything does, like youre trying to teach yourself what youre seing or trying to " guess" , then go back to the video or go forward until youre sure you understood ( at least on a basic basic level) what they are doing and why ( which is the important thing to catch when you explain to yourself) they are doing it.
@GreatFall
@GreatFall 4 жыл бұрын
Blackyonbi Kage thanks!!
@dogsliketobark585
@dogsliketobark585 3 жыл бұрын
not gonna lie I understand your explanation than my own professor I already watch the first sequence before this videos and thanks for sharing this kind of content it's so helpful for students like me
@PDCMYTC
@PDCMYTC 4 жыл бұрын
Brackeys: Has made an AI system, Navmesh, Shaders, and all advanced stuff Brackeys again: How to code! Don't read my name
@santa6674
@santa6674 4 жыл бұрын
I'll not
@chief9894
@chief9894 4 жыл бұрын
Ok I won’t
@johnes2337
@johnes2337 4 жыл бұрын
I'm not subscribing to you.
@amadeus3341
@amadeus3341 4 жыл бұрын
Thank u brackeys. Really thank you. Im too poor to get into University to study stuff like this but u make me learn the basics and im very happy u did. I love you. Stay healthy and safe
@scottdongnguyenkhang2878
@scottdongnguyenkhang2878 4 жыл бұрын
Console.Write("I want more tutorial");
@user-sz6dm8fy2m
@user-sz6dm8fy2m 4 жыл бұрын
underrated comment
@PedrovoriskAB
@PedrovoriskAB 3 жыл бұрын
@@user-sz6dm8fy2m Console.WriteLine *
@flaksick
@flaksick 2 жыл бұрын
This video is actually a good tutorial for all progamming languages because aside from santax all progamming languages have the same basic functions.
@flaksick
@flaksick 2 жыл бұрын
Stop scamming people
@SharkBite739
@SharkBite739 Жыл бұрын
Brackey is the god of tutorials
@Neozziee
@Neozziee 10 ай бұрын
I’m already familiar with C language, but these tutorials are really good!
@Maggiethegsd
@Maggiethegsd 4 жыл бұрын
Please post more often, I know high quality vids like your take a lot of time (writing the video script, filming, editing, rendering and uploading!) and your schedule is per week. By the way, yet another awesome video team brackeys!
@user-sz6dm8fy2m
@user-sz6dm8fy2m 4 жыл бұрын
this is rlly helpful since i am a new learning C# please make more
@Whopper3
@Whopper3 4 жыл бұрын
I’m sooooo happy you are doing these videos
@Brainyplanet
@Brainyplanet 4 жыл бұрын
Love these tutorials! Hope these tutorials never ends! And the intro was very funny 😂
@alexanderkalchev188
@alexanderkalchev188 4 жыл бұрын
Finally somebody explained for loops easy for beginners
@mrblackw0lfo839
@mrblackw0lfo839 4 жыл бұрын
Thx yet again brackey
@axolotl2959
@axolotl2959 2 жыл бұрын
Accidentally made a randomized math quiz game instead of watching this, I still cannot believe that I'm actually having fun programming.
@syllight9053
@syllight9053 4 жыл бұрын
I WILL MISS YOU
@divaysud4487
@divaysud4487 3 жыл бұрын
You can take this a step further: Console.Write("How many numbers do you want: "); double count = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); double enter = Convert.ToDouble(Console.ReadLine()); for (int i = 1; i
@abdul-ghafourkadour7985
@abdul-ghafourkadour7985 3 жыл бұрын
this guy knows how to teach
@Orincaby
@Orincaby 3 жыл бұрын
0:05 sneaky beaky like
@tzebruh
@tzebruh 3 жыл бұрын
for loops - the scariest thing in all of c#
@pbthemass9374
@pbthemass9374 4 жыл бұрын
Petition for Brackeys to Give a tutorial about 3d Enemy AI with Guns and Shooting. Pow Pow!!!
@xeno_link7370
@xeno_link7370 3 жыл бұрын
thx brackeys i watch one of these videos each day
@newbiegeek8407
@newbiegeek8407 4 жыл бұрын
thanks a lot sir for amazing videos! i really like game dev and your channel has helped me a lot learning everyday (for about 2 hrs)
@BROandGOAT
@BROandGOAT 4 жыл бұрын
!For any newbies like myself! If you want it so the user HAS to press the Enter key, use this: while (Console.ReadKey().Key != ConsoleKey.Enter) { } It uses a while loop to keep repeating the ReadKey method until the user presses Enter. Here's a full example: using System; namespace Loops { class Program { static void Main(string[] args) { //Console Appearance Console.Title = "TRY TO ROLL A SIX!"; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; Console.WindowHeight = 20; Console.WindowWidth = 65; //Game part Random numberGen = new Random(); int roll = 0; int attempts = 0; Console.WriteLine("Press ENTER to roll the die."); while(roll != 6) { while (Console.ReadKey().Key != ConsoleKey.Enter) { } roll = numberGen.Next(1, 7); Console.WriteLine(" You rolled: " + roll); attempts++; if(roll == 6) { Console.WriteLine("You rolled a six!"); } else { Console.WriteLine("Press ENTER to try again!"); } } Console.WriteLine("It took you " + attempts + " attempt(s) to roll a 6."); Console.WriteLine("Press ENTER to exit."); while (Console.ReadKey().Key != ConsoleKey.Enter) { } } } } Maybe there's an easier way to do this? Like I said I'm new to this too but it works :p
@samarth2117
@samarth2117 4 жыл бұрын
i am loving this series 😍😍 keep it up love from India
@raveendraramani9501
@raveendraramani9501 4 жыл бұрын
Im a unreal engine dev but im watching this cuz its a brackeys video
@kungjocke9446
@kungjocke9446 4 жыл бұрын
Best tutorials for programming for sure!
@kungjocke9446
@kungjocke9446 4 жыл бұрын
But I have to run them on 0,75 speed, because damn you speak fast!
@shazam320
@shazam320 4 жыл бұрын
This is so helpful. Thanks bro!!
@shacharpenn325
@shacharpenn325 4 жыл бұрын
Someone from twiter say that:"You really need to sell your custom keyboard as a product in your store, It's such a cool keyboard and I know a LOT of people who would want that keyboard."
@Akeiga
@Akeiga 4 ай бұрын
Honestly learning so much! Thank you!
@MI-mf7sj
@MI-mf7sj Жыл бұрын
I would need a new Vocabulary to describe you, as AWESOME, AMAZING, I am in LOVE with you does not some up my emotions enough...
How to Program in C# - Arrays (E05)
17:01
Brackeys
Рет қаралды 448 М.
How to Program in C# - Methods (E06)
17:20
Brackeys
Рет қаралды 336 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
37:51
bayGUYS
Рет қаралды 559 М.
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 41 МЛН
УДИВИЛ ВСЕХ СВОИМ УХОДОМ!😳 #shorts
00:49
Learning C# In A Week... Otherwise I Fail University
9:04
6.3 Iteration: Nested Loops - Learning C#
10:17
ParametricCamp
Рет қаралды 8 М.
Best Games from the Brackeys Game Jam 2024.2!
13:53
Brackeys
Рет қаралды 145 М.
Mindset of Successful Programmers
4:56
bigboxSWE
Рет қаралды 1,1 МЛН
LAVROV's interview with Tucker CARLSON 😁 [Parody]
8:34
Юрий ВЕЛИКИЙ
Рет қаралды 274 М.
C# for loops 🔁
3:49
Bro Code
Рет қаралды 46 М.
How to Program in C# - Classes (E07)
19:41
Brackeys
Рет қаралды 425 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 748 М.
The Future of Game Development
8:58
Brackeys
Рет қаралды 1,3 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
37:51
bayGUYS
Рет қаралды 559 М.