In less than seven minutes, you've explained how a for loop is nothing more than a while loop written in a different fashion, re-written a while loop into a for loop, identified, named, and ordered the operation of each component in both loops, and input into your code to prove that they both work, while comparing the functional value of each in what would amount to production-level code. This is a FANTASTIC instructional video! Thank you so much for breaking each element of this down, step-by-step, into an easy-to-understand methodology. I'm now really looking forward to watching many more of your videos! :D
You're an amazing instructor! I have tried to learn programming multiple times and this is the fist time I feel like I truly understand everything going on in my sketch. Thank you!
Before I watched your video, I'm saying to myself (beginner btw) I understand while loops, but not for loops. Now I know they're exactly the same thing written differently. Doesn't come across at all from other teachers online (including freecodecamp). Super thanks.
Dude You are THE best! I decided to get into programing and, being a designed, thought it would be hard getting into those technical things. And it was hard, until I found your videos. This is as good as it gets! Your excitement and fun way of teaching makes it so good and in some way relatable and assuring! Thanks a lot for this incredible work you've done!
I saved the academic year, thank you very much from Argentina ♥♥♥ Argentine translation: Como zafe de recursar en la facu, muchas gracias desde Argentina jajaja
Great examples Professor Shiffman, and really appreciate learning from you. One frustration we new programmers have is trying to debug when we branch out on our own. I’m just wondering, is there a simple command one can place inside the program to make the code execution stop? This way we can determine that the program executes properly up to this point, then we can put this command later on in the code, help determine where in the code it is going wrong. Also, is there any ability to force the code to execute one command at a time, for example whenever we hit the space bar? That way we can watch the code and the animation as it progresses, and subsequently determine at which line it goes off track? Dave
why I cant use void setup() code at the most above line of scripts like other lessons?? when I write it down, it says "expecting EOF, found 'while'" ..!!
1. Is it possible to write a for loop with 2 variables? 2. I tried to making things with the loops and accidentally discovered line stitching! void setup(){ fullScreen(); background(17); } void draw(){ background(17); int x = 0; int y = mouseX; stroke(255); while(y > 0 && x < mouseX){ line(x, 0, 0, y); x += 20; y -= 20; } }
Sir, if loop condition for (i = 0; i < a1; ++i); can execute but for loop condition for (i = 0; i < 1a; ++i); can't execute can i execute for (i = 0; i < 1a; ++i);
Isn't there a difference in the way a For and While Loop operate within the Draw() Loop? Do they both loop through their 'ranges' in one cycle of the draw loop?
Hi! I have a question I gave the for loop the condition < 11, and it still goes on and on and on (infinite) Can someone help me :)? void setup() { size ( 800, 600); background (255); } /** * VARIABELEN */ int x = 0 ; // x coordinate int y = 300; //y coordinate float schaal = 0.12; // scale boat /** * BOAT repeat */ void draw() { //BOOT 10 times for (int i = 0; i < 11; i++) { //why does it goes on and on!? // wat is de waarde van i? //println("i heeft de waarde: " + i); x = x + 80; println("x heeft de waarde: " + x);
/** * BOAT draw */ fill(0); rect(x, y - schaal * 150, // X ankerpoint schaal * 10, schaal * 300); //mast fill(255); triangle( x + schaal * 10, y - schaal * 150, x + schaal * 200, y + schaal * 50, x + schaal * 10, y + schaal * 50); // seil fill(#F70A0A); noStroke(); rect(x - schaal * 200, y + schaal * 100, schaal * 350, schaal * 100); // boat triangle( x - schaal * 250, y + schaal * 100, x - schaal * 200, y + schaal * 100, x - schaal * 200, y + schaal * 200); //left side boat triangle( x - schaal * 200, y + schaal * 100, x + schaal * 200, y + schaal * 50, x + schaal * 150, y + schaal * 200); //right side boat } }
Your explanation doesn't make amy sense! ıf the increment or decrement part was the 3rd part/ step how why is it at the end of the while loop then? Should be 1. initialization , condition, the code and then increment or decrement.
It is so nice that you're always smiling.
right? I'm sitting here thinking about how I can get that happy in life
just by smiling so suddenly, it makes your brain think ur happy... N if ur brain'll think it.. you think u happy 2
In less than seven minutes, you've explained how a for loop is nothing more than a while loop written in a different fashion, re-written a while loop into a for loop, identified, named, and ordered the operation of each component in both loops, and input into your code to prove that they both work, while comparing the functional value of each in what would amount to production-level code. This is a FANTASTIC instructional video! Thank you so much for breaking each element of this down, step-by-step, into an easy-to-understand methodology. I'm now really looking forward to watching many more of your videos! :D
This guy is funny and can make something "dry" like programming fun and interesting to learn
For( int thanks = 1; thanks< infinite; thanks= thanks +2) { printIn("you are amazing "); }
you're welcome!
ctrl + c
@@mousex5532 ha
Why is your avatar a Mr. Beaker / Clockwork orange mashup?
@@benzo-diazepine I guess we will never know 😢
this dude teaches way better then my school teacher.my teacher basically told me about da and I found treasure..
+Shaheryar Alvi Thanks for watching!
You're an amazing instructor! I have tried to learn programming multiple times and this is the fist time I feel like I truly understand everything going on in my sketch. Thank you!
I am so happy to hear this! Especially considering how old these videos are!
Damn we need more professors like him
Best teacher ever
Carolina Mattos ¡sure!
Seems like such a sweet guy, and an exceptionally enthusiastic teacher. I would've paid to be in his class.
Proof that too much coffee and talking too fast isn't a bad thing, as long as you're a good teacher, or even a teacher at all. Good Teacher!
Before I watched your video, I'm saying to myself (beginner btw) I understand while loops, but not for loops. Now I know they're exactly the same thing written differently. Doesn't come across at all from other teachers online (including freecodecamp). Super thanks.
Dude You are THE best! I decided to get into programing and, being a designed, thought it would be hard getting into those technical things. And it was hard, until I found your videos. This is as good as it gets! Your excitement and fun way of teaching makes it so good and in some way relatable and assuring! Thanks a lot for this incredible work you've done!
Thank you for making this so simple. Took me way too long to find this video and understand these loops. Forever grateful
Thank you so much for making my life easier. Next year Im definitely majoring with computer engineering because of your videos
for(;;){
System.out.println("The Coding Train is the BEST teacher!!!");
}
3:16 in the video ... hilarious glad it wasn't edited!!
You finally made me understand how to use for loops. Thank you very much
Thanks for the pure information and letting people save the time!
good teacher, he sounds so happy 8) nice guy, nice teacher
I was wondering why the for loop is like this, and now I understand.
Thank you so much. It was this video that made me understand how a for loop works and how to use it.
I saved the academic year, thank you very much from Argentina ♥♥♥
Argentine translation: Como zafe de recursar en la facu, muchas gracias desde Argentina jajaja
I personlly like the for-loop much more then the while-loop, because appears more logical comprehensibly to me.
best for loop video!
thank you very much for the knowledge
You're welcome, thanks for watching!
great tutorial!
you are really good teacher i admit that
awesome ,you made it easy for me
Great examples Professor Shiffman, and really appreciate learning from you. One frustration we new programmers have is trying to debug when we branch out on our own. I’m just wondering, is there a simple command one can place inside the program to make the code execution stop? This way we can determine that the program executes properly up to this point, then we can put this command later on in the code, help determine where in the code it is going wrong.
Also, is there any ability to force the code to execute one command at a time, for example whenever we hit the space bar? That way we can watch the code and the animation as it progresses, and subsequently determine at which line it goes off track? Dave
it's weird but contrary to your statement, for loops are just easier to understand, while had me wild'n.
It help me a lot thank you very much😁😁
this was such a fun video! :) brilliant! #timeless
“on today’s quiz show, what is something the coding train never does?”
“Yeah, can i get “edit that out” for 300?”
Thanks!
try this one in processing3
int x = 0;
int y = 0;
void setup() {
size(940,940);
}
void draw() {
for (y = 0;y < height;y += 10){
line(0,y,y,width);
}
}
why I cant use void setup() code at the most above line of scripts like other lessons?? when I write it down, it says "expecting EOF, found 'while'" ..!!
Im an 8th grader and this probably saved me from failin my test today
super teacher (y) ;)
this guy teaches me the whole of my computer science degree in term of programming that too 3years waste of time.
100 percent identical, the different is😊
I really like you my friend, good charisma, nice video 😊😊
You are awesome 😎!!!
what's happen if I need to drawn a grid of line with the random function and no line(function)? Basically I need the point(function). Can you answer?
I all of a sudden want to touch his beard...can I?
*MD R. Hossain wants to know Dan's location*
Very good
My God ,you're teaching using C maybe ...... Awesome...
Hi I have question ! How are While loops and for loops equivalent if they are set up different? And How do you turn a while loop into a for loop?
1. Is it possible to write a for loop with 2 variables?
2. I tried to making things with the loops and accidentally discovered line stitching!
void setup(){
fullScreen();
background(17);
}
void draw(){
background(17);
int x = 0;
int y = mouseX;
stroke(255);
while(y > 0 && x < mouseX){
line(x, 0, 0, y);
x += 20;
y -= 20;
}
}
Sir, if loop condition
for (i = 0; i < a1; ++i);
can execute
but for loop condition
for (i = 0; i < 1a; ++i);
can't execute
can i execute
for (i = 0; i < 1a; ++i);
Tq bro for uploading but which language ur using
He is writing in Processing, a language based on Java. It is available at processing.org
Sir ,in while loop we put semicolon after initialization and also the condition of end of the loop but not after the increement why
You are the best
For make this grid, who is better while loop or for loop?
(I prefer for loop is more clean for me)
you didnt mention that the benefits of for also means you dont have to declare the floats or ints at the start of the code
In this video I cant see void setup() or void draw().. but it is working fine. What is different there, sir?
Processing allows you to write simple sketches in "static" mode without setup() and draw(). It's like having only setup().
You are awesome.
Isn't there a difference in the way a For and While Loop operate within the Draw() Loop? Do they both loop through their 'ranges' in one cycle of the draw loop?
that's correct. draw() does not affect how they operate it is simply an outer loop. more here: ua-cam.com/video/Z8s-7beNP1c/v-deo.html
Hi! I have a question
I gave the for loop the condition < 11, and it still goes on and on and on (infinite)
Can someone help me :)?
void setup() {
size ( 800, 600);
background (255);
}
/**
* VARIABELEN
*/
int x = 0 ; // x coordinate
int y = 300; //y coordinate
float schaal = 0.12; // scale boat
/**
* BOAT repeat
*/
void draw() {
//BOOT 10 times
for (int i = 0; i < 11; i++) { //why does it goes on and on!?
// wat is de waarde van i?
//println("i heeft de waarde: " + i);
x = x + 80;
println("x heeft de waarde: " + x);
/**
* BOAT draw
*/
fill(0);
rect(x, y - schaal * 150, // X ankerpoint
schaal * 10, schaal * 300); //mast
fill(255);
triangle( x + schaal * 10, y - schaal * 150,
x + schaal * 200, y + schaal * 50,
x + schaal * 10, y + schaal * 50); // seil
fill(#F70A0A);
noStroke();
rect(x - schaal * 200, y + schaal * 100,
schaal * 350, schaal * 100); // boat
triangle( x - schaal * 250, y + schaal * 100,
x - schaal * 200, y + schaal * 100,
x - schaal * 200, y + schaal * 200); //left side boat
triangle( x - schaal * 200, y + schaal * 100,
x + schaal * 200, y + schaal * 50,
x + schaal * 150, y + schaal * 200); //right side boat
}
}
you haven't closed the loop
Teachers so much more than my teachers its bad
js beginner here. The draw function is a loop, right?
❤️❤️❤️
How many loop can we use inside a void draw??
+Sir. Boaz Mutatay as many as you like (given the usual speed/memory constraints of a computer.)
L O O P S
how would I use a for loop to create a random assortment of "stars"
Something like this?
int starCount = 500;
int starSize = 5;
size(400, 400);
background(0);
fill(255, 255, 0);
for (int x = 0; x < starCount; x ++) {
ellipse(random(0 + starSize / 2, width - starSize / 2), random(0 + starSize / 2, height - starSize / 2), starSize, starSize);
}
this is not what we need....can you explain how the loops working? for problem solving comparing to Array
Which compiler
Ultra Cute.
3:16 hi 😁
funny thumbnail.
+Indigo Veilplume hah, indeed.
anyone knows how to write the same code but for python, im really struggling, cheers!
for i in range(0 , 10): here the i will be incremented by 1 from zero to ten
which is faster though?
You can try testing it yourself by setting a very large iteration.
can lie the for loop is more sexier!
We asked for loop, what the heck are you saying ???
contenidoneto
3 years ago
YES 1000th like!
Your explanation doesn't make amy sense! ıf the increment or decrement part was the 3rd part/ step how why is it at the end of the while loop then? Should be
1. initialization , condition, the code and then increment or decrement.
still don't understand
why do most computer nerds look like this?
Not best teacher
?my advice for you to be yourself way you act like this
For( int thanks = 1; thanks< infinite; thanks= thanks +2) { printIn("you are amazing "); }
contenidoneto
3 years ago
contenidoneto
3 years ago