6.3: For Loop - Processing Tutorial

Поділитися
Вставка
  • Опубліковано 2 лис 2024

КОМЕНТАРІ •

  • @ScientObject40
    @ScientObject40 6 років тому +87

    It is so nice that you're always smiling.

    • @imosdefinite
      @imosdefinite 4 роки тому +3

      right? I'm sitting here thinking about how I can get that happy in life

    • @x4vih338
      @x4vih338 3 роки тому +1

      just by smiling so suddenly, it makes your brain think ur happy... N if ur brain'll think it.. you think u happy 2

  • @jmg999
    @jmg999 5 років тому +26

    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

  • @bienne777
    @bienne777 6 років тому +67

    This guy is funny and can make something "dry" like programming fun and interesting to learn

  • @adhuc
    @adhuc 7 років тому +153

    For( int thanks = 1; thanks< infinite; thanks= thanks +2) { printIn("you are amazing "); }

  • @shaheryaralvi1904
    @shaheryaralvi1904 9 років тому +42

    this dude teaches way better then my school teacher.my teacher basically told me about da and I found treasure..

  • @nicolebarreras9921
    @nicolebarreras9921 2 роки тому +5

    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!

    • @TheCodingTrain
      @TheCodingTrain  2 роки тому +2

      I am so happy to hear this! Especially considering how old these videos are!

  • @HydroDre
    @HydroDre 5 років тому +27

    Damn we need more professors like him

  • @carolinamattos2009
    @carolinamattos2009 8 років тому +92

    Best teacher ever

  • @zahrarizvi9810
    @zahrarizvi9810 5 років тому +5

    Seems like such a sweet guy, and an exceptionally enthusiastic teacher. I would've paid to be in his class.

  • @陈瀚龙
    @陈瀚龙 6 років тому +3

    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!

  • @interestingworld1569
    @interestingworld1569 3 роки тому

    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.

  • @No2Mz
    @No2Mz Рік тому

    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!

  • @notgavincrenshaw
    @notgavincrenshaw 3 роки тому +2

    Thank you for making this so simple. Took me way too long to find this video and understand these loops. Forever grateful

  • @madiaumotloung7600
    @madiaumotloung7600 3 роки тому +1

    Thank you so much for making my life easier. Next year Im definitely majoring with computer engineering because of your videos

  • @yxshmusic
    @yxshmusic 7 років тому +12

    for(;;){
    System.out.println("The Coding Train is the BEST teacher!!!");
    }

  • @timmccoigjr
    @timmccoigjr 5 років тому +6

    3:16 in the video ... hilarious glad it wasn't edited!!

  • @michaelgonzales8045
    @michaelgonzales8045 2 роки тому

    You finally made me understand how to use for loops. Thank you very much

  • @ilgazkuscu5600
    @ilgazkuscu5600 6 років тому +1

    Thanks for the pure information and letting people save the time!

  • @oPtiCzon3
    @oPtiCzon3 7 років тому +3

    good teacher, he sounds so happy 8) nice guy, nice teacher

  • @Mopki3
    @Mopki3 4 роки тому +1

    I was wondering why the for loop is like this, and now I understand.

  • @VICE-H3RO
    @VICE-H3RO 3 роки тому

    Thank you so much. It was this video that made me understand how a for loop works and how to use it.

  • @johannaemiliavargas5138
    @johannaemiliavargas5138 5 років тому +1

    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

  • @spezistyle
    @spezistyle 7 років тому +1

    I personlly like the for-loop much more then the while-loop, because appears more logical comprehensibly to me.

  • @yuhanwang418
    @yuhanwang418 6 років тому +4

    best for loop video!

  • @diegoferreira3444
    @diegoferreira3444 7 років тому +3

    thank you very much for the knowledge

  • @AlexCio
    @AlexCio 6 років тому +4

    great tutorial!

  • @programmer49
    @programmer49 7 років тому

    you are really good teacher i admit that

  • @girlingame518
    @girlingame518 4 роки тому

    awesome ,you made it easy for me

  • @misterhiker
    @misterhiker 4 роки тому +1

    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

  • @born5094
    @born5094 5 років тому +1

    it's weird but contrary to your statement, for loops are just easier to understand, while had me wild'n.

  • @thepenguin9700
    @thepenguin9700 5 років тому

    It help me a lot thank you very much😁😁

  • @edutainment9235
    @edutainment9235 3 роки тому

    this was such a fun video! :) brilliant! #timeless

  • @Mira-bp2ye
    @Mira-bp2ye 3 роки тому

    “on today’s quiz show, what is something the coding train never does?”
    “Yeah, can i get “edit that out” for 300?”

  • @aaronargottelopez3488
    @aaronargottelopez3488 4 роки тому +1

    Thanks!

  • @Quidoute
    @Quidoute 3 роки тому

    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);
    }

    }

  • @신입사원김조니의삶
    @신입사원김조니의삶 5 років тому

    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'" ..!!

  • @arttu149
    @arttu149 4 роки тому

    Im an 8th grader and this probably saved me from failin my test today

  • @sosobezhitashvili7896
    @sosobezhitashvili7896 9 років тому +7

    super teacher (y) ;)

  • @blenderremastered9959
    @blenderremastered9959 5 років тому

    this guy teaches me the whole of my computer science degree in term of programming that too 3years waste of time.

  • @jhanolaer8286
    @jhanolaer8286 3 роки тому

    100 percent identical, the different is😊

  • @abdelaziz5233
    @abdelaziz5233 4 роки тому

    I really like you my friend, good charisma, nice video 😊😊

  • @shmokh4289
    @shmokh4289 4 роки тому

    You are awesome 😎!!!

  • @xXLallaStellinaXx
    @xXLallaStellinaXx 7 років тому

    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?

  • @whenthethebeansstrikeback6728
    @whenthethebeansstrikeback6728 5 років тому +5

    I all of a sudden want to touch his beard...can I?

    • @angelcaru
      @angelcaru 3 роки тому +1

      *MD R. Hossain wants to know Dan's location*

  • @adityabhambure1166
    @adityabhambure1166 4 роки тому

    Very good

  • @fiddlewidmatoe8310
    @fiddlewidmatoe8310 6 років тому

    My God ,you're teaching using C maybe ...... Awesome...

  • @isaiahcampion4666
    @isaiahcampion4666 6 років тому

    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?

  • @er4795
    @er4795 7 років тому

    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;
    }
    }

  • @iqbal159
    @iqbal159 3 роки тому

    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);

  • @Ravikumar-gj6qw
    @Ravikumar-gj6qw 4 роки тому

    Tq bro for uploading but which language ur using

    • @sharath2273
      @sharath2273 4 роки тому

      He is writing in Processing, a language based on Java. It is available at processing.org

  • @bhawnachoudhary8167
    @bhawnachoudhary8167 5 років тому

    Sir ,in while loop we put semicolon after initialization and also the condition of end of the loop but not after the increement why

  • @Alebtong1
    @Alebtong1 7 років тому

    You are the best

  • @PorroYMonster
    @PorroYMonster 2 роки тому

    For make this grid, who is better while loop or for loop?

    • @PorroYMonster
      @PorroYMonster 2 роки тому

      (I prefer for loop is more clean for me)

  • @Veveve1
    @Veveve1 Рік тому

    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

  • @Riteshbachhar
    @Riteshbachhar 7 років тому +1

    In this video I cant see void setup() or void draw().. but it is working fine. What is different there, sir?

    • @TheCodingTrain
      @TheCodingTrain  7 років тому +6

      Processing allows you to write simple sketches in "static" mode without setup() and draw(). It's like having only setup().

  • @vinayraj2879
    @vinayraj2879 6 років тому

    You are awesome.

  • @supernaturalswampaids8083
    @supernaturalswampaids8083 8 років тому

    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?

    • @TheCodingTrain
      @TheCodingTrain  8 років тому +3

      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

  • @JeAssxD
    @JeAssxD 8 років тому

    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
    }
    }

  • @TheRobdog7
    @TheRobdog7 4 роки тому

    Teachers so much more than my teachers its bad

  • @samuelabreu4349
    @samuelabreu4349 7 років тому

    js beginner here. The draw function is a loop, right?

  • @JesseSep.
    @JesseSep. 4 роки тому

    ❤️❤️❤️

  • @Sir_BoazMutatayi
    @Sir_BoazMutatayi 8 років тому

    How many loop can we use inside a void draw??

    • @TheCodingTrain
      @TheCodingTrain  8 років тому +1

      +Sir. Boaz Mutatay as many as you like (given the usual speed/memory constraints of a computer.)

  • @manplaysstuff9725
    @manplaysstuff9725 5 років тому +1

    L O O P S

  • @benjaminmalowitz8434
    @benjaminmalowitz8434 7 років тому

    how would I use a for loop to create a random assortment of "stars"

    • @austinobringer1266
      @austinobringer1266 6 років тому

      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);
      }

  • @safdarstellosys1059
    @safdarstellosys1059 5 років тому

    this is not what we need....can you explain how the loops working? for problem solving comparing to Array

  • @zeus8406
    @zeus8406 4 роки тому

    Which compiler

  • @kathalilu
    @kathalilu 3 роки тому

    Ultra Cute.

  • @AnonymouS-tk2le
    @AnonymouS-tk2le 2 роки тому

    3:16 hi 😁

  • @AryehAmitz
    @AryehAmitz 9 років тому +2

    funny thumbnail.

  • @prophetreimagine1967
    @prophetreimagine1967 5 років тому

    anyone knows how to write the same code but for python, im really struggling, cheers!

    • @DjanilsonMartins
      @DjanilsonMartins 5 років тому +3

      for i in range(0 , 10): here the i will be incremented by 1 from zero to ten

  • @RomboutVersluijs
    @RomboutVersluijs 6 років тому

    which is faster though?

    • @0xsuperman
      @0xsuperman 6 років тому

      You can try testing it yourself by setting a very large iteration.

  • @blenderremastered9959
    @blenderremastered9959 5 років тому

    can lie the for loop is more sexier!

  • @jithendrauppalapati7773
    @jithendrauppalapati7773 5 років тому

    We asked for loop, what the heck are you saying ???

  • @cosmiccoder2102
    @cosmiccoder2102 4 роки тому

    contenidoneto
    3 years ago

  • @justannormalpianist
    @justannormalpianist 5 років тому

    YES 1000th like!

  • @FirdavsiGameDev
    @FirdavsiGameDev 4 роки тому

    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.

  • @deondrawaldron3181
    @deondrawaldron3181 5 років тому

    still don't understand

  • @jigwe
    @jigwe 5 років тому

    why do most computer nerds look like this?

  • @kaminibenprajapati4336
    @kaminibenprajapati4336 5 років тому +1

    Not best teacher

  • @programmer49
    @programmer49 7 років тому

    ?my advice for you to be yourself way you act like this

  • @cosmiccoder2102
    @cosmiccoder2102 4 роки тому

    For( int thanks = 1; thanks< infinite; thanks= thanks +2) { printIn("you are amazing "); }

  • @cosmiccoder2102
    @cosmiccoder2102 4 роки тому

    contenidoneto
    3 years ago

  • @cosmiccoder2102
    @cosmiccoder2102 4 роки тому

    contenidoneto
    3 years ago