Hi Daniel! Nice tutorials. Loved your way of presenting them with a smile. Keep it on. Also you keep on asking if any one would watch them...let me tell you I am watching them for last 4+ hours. :)
you are an incredible and passionate teacher who makes even boring stuffs look really really really interesting ! i resolved to make this comment every time i watch your vid comment 2/x
This guy's teaching style is brilliant and i can totally see why its worthwhile showing us the while loop. It help me understand the concept of for loops so much more clearly..I bookmarked the page and subscribed to the channel...I am officially on the coding train :)
dude, I LOVE the while loop. When the condition in the for loop in not constant, it can lead to really weird errors (array index out of range, etc.) while loop is perfect in those cases.
Tahnk you so much for doing these videos, I gave it a shot using the map() funct + for loop. Early days, slow progress but enjoying the train ride! function setup() { createCanvas(600, 400); } function draw() { noStroke(); background(220); var minCol = color(51,59,53); var maxCol = color(137,156,142);
Worth mentioning that there's also a shorthand *++i* . Which differs from *i++* because if you have *++i* in an expression *i* is first incremented and only after evaluated.
You, are one of the greatest teachers i've ever had! The best in the internet so far and the best in coding :) Back to learning for me. through you.. to make the world a better place... what? o.O -Its nothing.
About 11:25 into the video, line number "17" is highlighted in yellow because the IDE is issuing a warning that the variable "x" has already been declared. To read the actual warning message, just click on the yellow highlighted line number and the text will appear in a little pop-up text box. To correct this warning, remove "var" from within the for loop's argument list, like so: for (x = 0; x < width; x = x + 50) { You should find that this fix will make the warning go away. I'm sure Dan knows about this, but didn't want to waste time talking about this small detail in order to keep his video short (under 10 minutes).
no body loves the *do while* loop... XD EDIT: your videos are very helpful, i am able to learn new things about programming!! please keep up the good work
I was just wondering where the width element came from when you were writing your while loop. I thought you would need to create a variable for that word "width" and assign it a value. Is it apart of the p5.js library, and that's why you can use it? Just need to understand that part. @The Coding Train
If for loops are best practice than why do they teach while loops? Also var is now replaced by let correct? So is let now best practices other than var? Sorry I am new and get confused because classes I’m taking still use var but I hear should be Let now.
Hi, why when declare x as a local variable in draw function and we then add 50 the operation happen once and when we declare x as global variable 50 is added to x continuously (x+50=100, 100+50=150, ..... ) so when we run it we got a moving ball.
I know this is a while ago, but the reason this happens is that when you declare it in draw then add 50 to it in draw, it keeps looping. The effect of this means that first x is set to 0 (or the number you started with), then 50 is added to it. Then when the draw function starts again, it resets x to 0, then adds 50 again. This then happens forever.
"A 'for loop' consists of three different expressions inside of a parenthesis, all of which are optional. These expressions are used to control the number of times the loop is run. The first expression is a statement that is used to set the initial state for the loop. The second expression is a condition that you would like to check before each loop. If this expression returns false then the loop will exit. The third expression is executed at the end of each loop."
hey I'm a beginner and a little bit confused what the width means here ( if x < .... ) is with width the width of the canvas meant? or the width of the ellipse? helppppp haha
Hello, Thank you for you videos, I love them! I'd always wanted to learn coding but never knew where to start... now thanks to you and good structured lessons I know =) Btw in the end of this video you explain x++. My question is, is there something similar than ++x (like in c++)?
It appears before I draw the bubbles so the bubbles appear on top. For more, ask at discourse.processing.org/! It's a better platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.
In the beginning of the lesson I was very confused cause I thought that the draw function went on forever so why does the ellipses with the +1 x only go so many times
Yup, it does matter when you use each! For loop are counted loops- they are used for it you want something to repeat a set number of times, and this is specified in the boolean condition in the middle of thr got loop (ex. i < 4). While loops however are used after a condition is met. Such as while (!gameOver) {// do this}. They will ONLY RUN if the condition in the while loop is true! In summary, for loops are counted loops whereas while loops are conditional loops.
i think while loop is better than for loop because it flexible e.g while loop that cant be achieved using for loop. public static List ShuffleList(List inputList) { List randomList = new List(); Random r = new Random(); //using random int randomIndex = 0; while (inputList.Count > 0) { // choose between 1 and the MaximumNumberOfQuestions randomIndex = r.Next(0, inputList.Count); randomList.Add(inputList[randomIndex]); inputList.RemoveAt(randomIndex); } return randomList;
It's not that you're just good at explaining, it's that you're good a at inspiring ideas.
I don’t know anyone else who smiles this much while coding
Brackeys:)
its been almost 10 yrs since these were made, im watchin in 24/25, and they are great. He is so energetic its easy to watch
Omg you are so good at explaining things I’m recommending to anyone who needs these tutorials
And you are really beautiful
@@ciceroaraujo5183 what the Fuck
@@ciceroaraujo5183 no i don't think so
@@ciceroaraujo5183 not my type
@@Aryaman_Agarwal And no one asked you? Find the defintion of a "opinion"
Hi Daniel! Nice tutorials. Loved your way of presenting them with a smile. Keep it on. Also you keep on asking if any one would watch them...let me tell you I am watching them for last 4+ hours. :)
+Akhil Kashyap oh, i am so glad to hear that thank you!
@@TheCodingTrain i have been watching for about 4 hrs
@@TheCodingTrain after 5 years, i'm still watching these nonstop. You are the greatest teacher!
you are an incredible and passionate teacher who makes even boring stuffs look really really really interesting !
i resolved to make this comment every time i watch your vid
comment 2/x
I've been lost this whole time between for loop and while loop. Thank you for explaining it to us so clearly.
So glad to hear!
U're the best teacher i've ever seen. I wish all the best for you from Turkey!!!
Thanks so much!
This guy's teaching style is brilliant and i can totally see why its worthwhile showing us the while loop. It help me understand the concept of for loops so much more clearly..I bookmarked the page and subscribed to the channel...I am officially on the coding train :)
Welcome! Choo choo!
Thanks. I have watched a lot of lessons regarding for and while loops, but yours is the most concise and easiest to understand.
Daniel, if everybody else were as clear and understandable as you, our nations might have world peace at last!!!
I respect you 3000 . Best Teacher on the planet!
best programming tutorial ive ever seen!!!!
dude, I LOVE the while loop.
When the condition in the for loop in not constant, it can lead to really weird errors (array index out of range, etc.)
while loop is perfect in those cases.
Your videos are really very very helpful. I was lagging in this topic for weeks you cleared it. Appreciated it good work.
regards from India.
Hi Dan, I've thoroughly enjoyed all your videos and my javascript is rapidly improving. Thanks so much for all your efforts and great job sir!
+Sean Stoddart so glad to hear!
I love your way of explaining, and also the format of your video, very unique and useful for the explanaition
Tahnk you so much for doing these videos, I gave it a shot using the map() funct + for loop. Early days, slow progress but enjoying the train ride!
function setup() {
createCanvas(600, 400);
}
function draw() {
noStroke();
background(220);
var minCol = color(51,59,53);
var maxCol = color(137,156,142);
for (var x = 0; x
You saving my LIFE... thank you soo much... regards from Germany ;)
+Sinan S thanks for watching!
Worth mentioning that there's also a shorthand *++i* . Which differs from *i++* because if you have *++i* in an expression *i* is first incremented and only after evaluated.
Prefix and postfix operator. He probably didn't mention cuz it may just overwhelm beginners.
@@johnyepthomi892 yup
@@johnyepthomi892 I'm overwhelmed
You simplify everything so well. Hats off, Dan! I wanna be a professor too. I am inspired by you a lot!
Thank you for making the content understandable for beginners! You did an amazing job of it.
All great stuff, please keep it coming, learning a lot, thanks
Thank you so much for making these video tutorial. They are absolutly brilliant. After some other online courses and tutors you are the best.
You, are one of the greatest teachers i've ever had!
The best in the internet so far and the best in coding :)
Back to learning for me. through you.. to make the world a better place... what? o.O
-Its nothing.
It's still the last day of 2022 (Toronto). This series is still the best I found for learning JavaScript and p5js.
best teacher in whole world
You are the best professor.
You're amazing!!! Thank you for sharing this
Incredible! You have helped teach for and while in such a simple and wonderful way! Thank you !
Thank you for helping me. This made me understand loops now thank you
Thank you. You saved me from the volcano of confusion
You are the jesus of p5.js saving everyones life
You are an excellent teacher! Thank you for taking the time. I’ve subscribed and will continue to explore your videos! 🙏
This is insane. Thank you Daniel!
your the best teacher, make me easy to learn :) regards from India
the willpower of this man to not use += or ++ until this video
This was SO helpful! I appreciate your explanations. You made this so much easier to understand! Thank you!
Awesome tutorials! Your teaching method is crystal clear - I've learned a ton over the past couple of days. Thanks for sharing your knowledge.
About 11:25 into the video, line number "17" is highlighted in yellow because the IDE is issuing a warning that the variable "x" has already been declared. To read the actual warning message, just click on the yellow highlighted line number and the text will appear in a little pop-up text box. To correct this warning, remove "var" from within the for loop's argument list, like so:
for (x = 0; x < width; x = x + 50) {
You should find that this fix will make the warning go away. I'm sure Dan knows about this, but didn't want to waste time talking about this small detail in order to keep his video short (under 10 minutes).
Another great video, here is my code for 13:10
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
let x1=20;
while(x1
Very good explanation. I am th e dumbest guy in coding and you just made me an expert!
you have saved me by allowing me to revise my basics!!
wow,what a nice presentation, all the question i have about loops solved,,,,,keep smiling
awsome! you get me through my programming module :D Really comprehensive
Dan these videos are great! Love your teaching style, I'm learning a tonne.
谢谢!
Thank you for the support!
i wish this guy was my professor in college
Amazing tutorial!! Loved it!!
love your videos man, you're awesome
Excellent explanations 😊
Thank you so much for this amazing video ! U SAVED MY LIFE !
Amazing teaching!
Still after some time now this is so helpful.
Waooo teaching style is very impressive
What a wonderful video. Well explained.
'if' transfers to 'while' well. Glad you confirmed that.
I love u r smile and I enjoy your fun learning
GOd bless your life with Grace.
you are doing best
no body loves the *do while* loop... XD
EDIT: your videos are very helpful, i am able to learn new things about programming!! please keep up the good work
This... this guy is making me learn and... And I am enjoying it!!! >:0 what is this dark magic that makes me get exited with numbers!?
You will help me pass my exams next month. Thank you sempai -_-
best programming tut
Thank you so much! This is very helpful.
Briliant, thank you. bless you
You did a great job explaining this concept thank you
I was just wondering where the width element came from when you were writing your while loop. I thought you would need to create a variable for that word "width" and assign it a value. Is it apart of the p5.js library, and that's why you can use it? Just need to understand that part. @The Coding Train
dude, you are perfect
Love from Nepal. 🇳🇵
dude, you are hilarious. and excellent, big thank you!
you can center by using "height / 2" for the y value instead of 200, it's better than hardcoding it IMO
If for loops are best practice than why do they teach while loops? Also var is now replaced by let correct? So is let now best practices other than var? Sorry I am new and get confused because classes I’m taking still use var but I hear should be Let now.
He: someone or no one might be watching this video
Every 85k viewers : 0-0
so good proffesor
How would use the for loo[p if u wanted to code in a parallelogram by using the "quad" function.
AWESOME TEACHER!!!
what if the shape has multiple x coordinates like triangle . How will loop will help to get a geometric pattern?
What is the closed caption at 1:03????
he looks so enthusiastic for the boringest shit ever. thanks though this helped quite alot
do u know how to make it come vertically instead of horizontal
question: why does the var x have to be in draw function for code to work? i tried making it global variable but results went eee orw
Hi, why when declare x as a local variable in draw function and we then add 50 the operation happen once and when we declare x as global variable 50 is added to x continuously (x+50=100, 100+50=150, ..... ) so when we run it we got a moving ball.
I know this is a while ago, but the reason this happens is that when you declare it in draw then add 50 to it in draw, it keeps looping. The effect of this means that first x is set to 0 (or the number you started with), then 50 is added to it. Then when the draw function starts again, it resets x to 0, then adds 50 again. This then happens forever.
Why ints in the brackets? Process i get, not sure what ints do though..
i think u should join white hat jr
because i m a white hat jr student and i didnt under stand this for loop in my class but u explain it very well
Hello, Sir... Is there anyway to use break; or continue; to stop looping?
can mouseX and Y be a variables? if so how?
When I add while (x < width) Google chrome crashes? X)
hi!
I get some error.
Uncaught ReferenceError: loopProtect is not defined (sketch: line 12)
can somebody help?
"A 'for loop' consists of three different expressions inside of a parenthesis, all of which are optional. These expressions are used to control the number of times the loop is run. The first expression is a statement that is used to set the initial state for the loop. The second expression is a condition that you would like to check before each loop. If this expression returns false then the loop will exit. The third expression is executed at the end of each loop."
thanks! that cleared that up for me.
Hello Mr Daniel, I am having a problem. When I try using the command 'while' the entire tab just lags out. Any tips on what I should do?
hey I'm a beginner and a little bit confused what the width means here ( if x < .... ) is with width the width of the canvas meant? or the width of the ellipse? helppppp haha
You can come and ask your questions and get help in the discord! It's a little hard to do in RUclips comments: thecodingtrain.com/discord
Why is this not working for me?? It says “Invalid left hand sign in assignment”. I copied your format but it still shows up
Hello,
Thank you for you videos, I love them! I'd always wanted to learn coding but never knew where to start... now thanks to you and good structured lessons I know =)
Btw in the end of this video you explain x++. My question is, is there something similar than ++x (like in c++)?
They both work
Why in your script, background(0); in Draw() {} don't erase bubbles anytime?
It appears before I draw the bubbles so the bubbles appear on top. For more, ask at discourse.processing.org/! It's a better platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.
Genius
Love and salute to YOU BY PAKISTAN
What about for each?
In the beginning of the lesson I was very confused cause I thought that the draw function went on forever so why does the ellipses with the +1 x only go so many times
Nvm
Ow I have a new issue! In brackets my for loop never works!
Thank you for the classes!
I've always been kinda lost as to when to use forLoops and whileLoops ? or does it not matter ?
Yup, it does matter when you use each! For loop are counted loops- they are used for it you want something to repeat a set number of times, and this is specified in the boolean condition in the middle of thr got loop (ex. i < 4).
While loops however are used after a condition is met. Such as while (!gameOver) {// do this}. They will ONLY RUN if the condition in the while loop is true!
In summary, for loops are counted loops whereas while loops are conditional loops.
i think while loop is better than for loop because it flexible
e.g
while loop that cant be achieved using for loop.
public static List ShuffleList(List inputList)
{
List randomList = new List();
Random r = new Random(); //using random
int randomIndex = 0;
while (inputList.Count > 0)
{
// choose between 1 and the MaximumNumberOfQuestions
randomIndex = r.Next(0, inputList.Count);
randomList.Add(inputList[randomIndex]);
inputList.RemoveAt(randomIndex);
}
return randomList;