A programmer's wife texted her husband. "While you're out, get milk." ...and she never saw him again.
@potato46876 жыл бұрын
well played
@KamariaIsHere6 жыл бұрын
🤣🤣
@mariuspet895 жыл бұрын
Hahaha :))) :))) nice
@GameSteals5 жыл бұрын
@@jordanclava931 By that example, husband will always be out, and there will never be milk. Hahahahaha
@itssupremesharma41045 жыл бұрын
@@GameSteals maybe thats the point Hahaha
@martinds937 жыл бұрын
If my college teacher putted just "1 bit" of this excitement to the programming classes, I would be happy. But I'm not, and im watching you. Thank you. Your videos are awesome. Im from argentina.
@kevinch36 жыл бұрын
hey tinchou I feel the same. abrazou
@rawanelabied66544 жыл бұрын
HAHAHAHAHAH
@angelcaru3 жыл бұрын
*p u t t e d*
@beatrizlisboasanchez89892 жыл бұрын
@@angelcaru He said he is from Argentina, which means English is not his native language 🙄
@angelcaru2 жыл бұрын
@@beatrizlisboasanchez8989 Mine isn't either.
@robertomerani7 жыл бұрын
Hello everybody. This is my first line of code where a ball bounces from right to left and moves down after reaching the right and left side of the screen. Thank you Daniel Shiffman for your time and patience. I never get tired of watching your videos. float x = 0; float xspeed = 10; float y = 320; float yspeed = 10; float up = 25; void setup () { background (127); size (1280, 640); } void draw () { noStroke (); fill (0); ellipse (x, y, 25, 25); x = x + xspeed; if (x > width || x < 0) { y = y + up; xspeed = xspeed *-1; } while (x < 0) { if (x > width) { y = y + up; } else { x = 0; noStroke (); fill (0); ellipse (x, y, 25, 25); } } }
@TheCodingTrain7 жыл бұрын
Nice work!!
@gg-lu3lt3 жыл бұрын
If someone still confused about 5:37 (why you have to reset x = 10 inside DRAW) and come across this comment I hope the code below can help explaining a bit more (copy and run it in your program.) There beginning of DRAW. until it reach > 400, then it draw the result) won't wrong, but this helped me understand this better. I also hope this could help you guys as well. Happy coding guys :D float x = 0; void setup() { size(400, 300); } void draw() { background(random(255)); while (x < width) { x = x + 1; fill(101); stroke(255); ellipse(x, 150, 16, 16); println("still in WHILE LOOP"); println(x); delay(10); } x = x + 1; println("outside now"); println(x); delay(1000); }
@openopinion42085 жыл бұрын
i have learned alot from your lectures and still learning.your videos are definitely the best on KZbin and of course amusing.thank you sir for these lectures.
@haleemulhassan91589 жыл бұрын
@5:37 I really didnt get the part where while loop does NOT draw how we expected, as you mentioned. The first time we go into the while loop, x = 0. Now in the while loop is the command of printing circles using the value of x. So shouldnt it keep drawing circles till the value of x>width within the while loop? Why did you have to put the value of x=0 again before the while loop to see any kind of result. Basically what Im asking is how is the value of x = width on the very second time in the while loop?
@TheCodingTrain9 жыл бұрын
+Haleem ul Hassan global variables maintain their value each time through draw. Each loop takes x from 0 to width. So when the loop ends, x equals width. When draw starts over again, x still equals width! So in order for us to see the things drawn again, we have to start x back at zero. It's a very confusing thing b/c the while loop is a loop and also draw() is a loop! This video explains a bit more: kzbin.info/www/bejne/kGnWXmqYmrODZ8U
@haleemulhassan91589 жыл бұрын
+Daniel Shiffman Ahhh now I got it. The video sure did explain the concept. Thank you :)
@abdulrahmankh16112 жыл бұрын
Thats the 2ed Time i understand nothing from my trash Teacher and watch your Videos before my exam instead and it really helps, i am thankful
@popcycleism6 жыл бұрын
Where is your school at? Coding with visual breakdown. I understand the concept better! Thank you for this!
@wallaceterra59933 жыл бұрын
I really enjoyed your class! His teaching is fun and very lively! Yes, your video came out perfectly, mistakes happen. Thanks!
@jamesfilosa62774 жыл бұрын
5:42 - Wouldn't it make more sense to move "background(0);" to setup instead? ...when demonstrating the purpose of the while loop.
@blackchan42494 жыл бұрын
please continue to ramble on. those bit make the video more interesting. Thank you!!
@abhishekkattimani13025 жыл бұрын
My all doubts with loops are get cleared thank you so much sir
@owpeezygaming9674 жыл бұрын
way longer than I expected, hehe i rather watch you even for an hour per episode
@reibangchakma4 жыл бұрын
1:26 how did you program that sound?
@stephmacindoe60753 жыл бұрын
Love the Dora reference, went to see the new film for my 20th birthday
@azrael99865 жыл бұрын
if you watch this at 1.75x or 2x speed it's beautiful, it's lovely, this is an example.
@kushbhogate62634 жыл бұрын
better watch at 0.25 x speed
@Maha_s19992 жыл бұрын
You are so likeable as a teacher!!! I love your style! Just starting CS50 and although not quite there with the coding language part (I assume this is C?) I feel this will be useful later 🙂
@achievementcell46316 жыл бұрын
I love this man.
@chaiyakheourn99708 жыл бұрын
I love your teaching so much!
@ruchisheth94305 жыл бұрын
At 5:04, when we are putting ellipse inside the while loop, the first time draw is executed, while function is executed with x being 0, it reaches width n stops but why ain't those circles seen? The second time draw has x =width so while will not execute but first time while function inside draw executes perfectly so why can't we see circles?
@ruchisheth94305 жыл бұрын
Just realized background is the culprit
@hoaang47595 жыл бұрын
Ok
@brystet66425 жыл бұрын
I will never stop
@raphaelmorgan23074 жыл бұрын
"I guess at this point just email if you have a question" the KZbin comments: am I a joke to you?
@ramachhetri53684 жыл бұрын
Him: Maybe you will, also conquer the universe or something. Thanos: I would have done that if the avengers didn't stop me!
@DruishQueen5 жыл бұрын
Hi! Why do you use "eclipse" instead of "circle" for the circle shape? Sorry if you went over this and I missed it!
@fredericomendonca45725 жыл бұрын
It's ellipsenot eclipse! And an ellipse might not be a circle
@DruishQueen5 жыл бұрын
Frederico Mendonça oh yeah I meant ellipse haha.
@jacobwojcik98884 жыл бұрын
I am having an issue with the starting bit of the video with the if statement. If we only run the block of code when x is less than 16 (the width of the ellipse), then wouldn't we get to the point where x = 16? And when evaluated against width (also with the value of 16) we get a false evaluation where we do not run the block of code, and then simply run the ellipse command with x = 16 over and over again. So, from this perspective the eventual coordinate for the ellipse would be (x = 16, y = 150). My expectations were to see the ellipse at that coordinate over and over because 16 (x) is never less than 16 (width), and so you would never update the value because you never run that line of code due to the evaluation being false. Of course, this perspective is wrong, because we clearly get an output that eventually ends with the ellipse coordinate of (x = 400, y = 150). Sorry for the long winded question, but I just can't seem to reason it through on my own. Any clarity would be greatly appreciated. Happy coding!
@celiacasimiro4654 жыл бұрын
9:15 Oh My! I have watched Dora The Explorer, before.
@parastoon37066 жыл бұрын
I had a really hard time digesting the "while" loop and still don't quite understand one thing. Why does it matter to reset x=0? I mean if you put "x=0;" before the While loop, shouldn't it be useless? pulling my hair out here...
@TheCodingTrain6 жыл бұрын
Would you mind asking 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.
@mikejones-vd3fg6 жыл бұрын
take the background out of the draw function and you'll see it draws all the circles without having to reset it to x = 0;
@elliotsefaradi45683 жыл бұрын
can you do that particle system with the while loop?
@xuefangzheng64545 жыл бұрын
Hi, I don't understand what makes it different when u add x = 0; before the while loop at the beginning of this video. It has already declared x and given it a value on the top of the code.
@TheCodingTrain5 жыл бұрын
Would you mind asking 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.
@andreacoricciati49094 жыл бұрын
What if I wanna make it go to left once I reach mouseX > 300?? I tried with x = x -1 with an if statement that says if(mouseX > 300 && mouseX < width){x = x-1} but it creates another loop once I reach 300 , it doesn't go "turn" the loop fo the left.
@MiksCasal3 жыл бұрын
Conquer the Universe. Yes. :D
@cyberguide_in8 жыл бұрын
Hi Daniel, I did not understand why did you declare x = 0 again if you had already done that earlier in the beginning float x = 0; ?
@TheCodingTrain8 жыл бұрын
+BABLU KUMAR Since draw() is repeating over and over again I need x to be reset back to 0 each time. The global "float x = 0;" could actually be removed here and only declare x in draw().
@cyberguide_in8 жыл бұрын
Thanks a lot. Well, I sent you a mail as well a few days back. Maybe you forgot to reply.
@theaeleonore43595 жыл бұрын
okay yeah I understand that, but how do I get rid of the previously drawn ellipse with the while loop?
@aangel-s2p3 жыл бұрын
nest background in the loop so it draws new background every loop
@rishoo69766 жыл бұрын
instead of doing x = x + 1, couldn't you do x++ or x+= 1?
@TheCodingTrain6 жыл бұрын
indeed!
@jusaggoldcow11257 жыл бұрын
u R getting good at the back and forth thing dan! lol
@mlittleprogramming7804 жыл бұрын
Great video!
@valbrownsmith56562 жыл бұрын
Since draw is already a loop, can't you use that loop instead of a while loop?
@debanjanaghosh66344 жыл бұрын
Writing int x=0 as global does nothing. local int x=0 in draw() makes the program run. Why? Please help
@ryanharris40665 жыл бұрын
Why mouseX actualizes with the "if"?
@TheRealHedgehogSonic5 жыл бұрын
Whenever I try to make a while loop in the draw() method of my programs, the window crashes. Can anyone tell me why?
@SuperMan-pd3kg6 жыл бұрын
thank you mate you were a great help
@tehnay48177 жыл бұрын
Instead of adding "fo"r statement inside "while", i just put "x=x+mouseX+1;" and got the same solution, i dont know should i, but i am just a little proud of myself for, making code smaller, by myself.
@Elxuekos9 жыл бұрын
take your time and dont worry, hopefully we'll get better explanations
@georgikocharyan33057 жыл бұрын
Hey, can I ask a question? If I change mouseX to mouseX / 5 as to create less of a space between circles, it works as intended, until mouseX drops under 3 (checked with println). Why? I can't really find out, I've tried a lot of things but it crashes as soon as your mouse dips left.
@georgikocharyan33057 жыл бұрын
nvm, solved it! Processing lops off the comma, so as soon as mouseX / 5 reaches 0. something, you get 0!
@post_hit_invincibility99407 жыл бұрын
Noob Question. When x is definded as 0 over and over again, this should mean that x = x+10 always definses x as 10, or? I do not get the logic here. Any Help? :)
@puphuc94157 жыл бұрын
x is definded as 0 over and over again, because he use background on draw(), so when the first time draw() finish, the result will be like we expect but because background on draw() and the x still = width so while() not work and screen still balck . So he must put x = 0 to each time draw{} execute to while() do its job. I am not native english speaker so i have some problem with this help. forgive me if you don't understand my answer because my poor in english
@gauravbanwari19816 жыл бұрын
if the background is in void draw(),then why dont we see the ellipse moving ? Instead there are multiple copies.
@ivanlin79956 жыл бұрын
because the while loop is place after the background(), when draw() begin, it sets the background first and draw all the ellipse then run draw() function again. draw -> set background -> draw ellipse -> draw -> ......
@jaredlester56285 жыл бұрын
What is the value of width?
@f_u_n_e_r_a_l7 жыл бұрын
Dan I miss to see all this great content, get well soon :)
@s.peanutbuterson67337 жыл бұрын
what happened?
@oorschot56263 жыл бұрын
I don't really get what happens when you reset X back to 0 every time through draw.. ?
@RobberDoDoro8 жыл бұрын
How to make the code of the bubble falling down? (the begin of this video one) thank you~
@timeslongpast8 жыл бұрын
Copy this into your code :D if(circleY > height || circleY
@SpyrodoZ6 жыл бұрын
can someone tell me whats wrong whit this code? void setup(){ size(500,500); } void draw(){ background(255,0,0); x = 0; { while( x < width) x = x +1; ellipse(x,250,50,50); } }
@rohanj966 жыл бұрын
you didn't write float x; in the top of the code. so the pc couldn't understand what x was. That's what I think the problem is
@---xp7yw6 жыл бұрын
it is because you didn't initialized the x.
@usmanlatif49854 жыл бұрын
hmmm.. copied and pasted this yet I get the following error "Script error. (: line 0)"
@Quidoute3 жыл бұрын
int thanks = 0; while(thanks < infinite) { println("THANKS and i hope i did no mistake"); }
@宋文鹏-v6f8 жыл бұрын
hey i have a question Why the video does not end?
@hectorgarlinga28999 жыл бұрын
the draw function contains a for loop?
@hectorgarlinga28999 жыл бұрын
+Daniel Shiffman thank you for your explanation, just saw the video "6-4A Loop Inside Draw" where you explain just that . i am amazed all the things you can do with processing, seems a very powerful tool.
@Calz20Videos7 жыл бұрын
I added a y... kinda could work as a coordinate plane.
@Majestic12zombies4 жыл бұрын
i dont get this code to work, when i move background to setup it works but yours is in draw and it keeps working, im in python's module and my code is the one below: x = 20 def setup(): size(600, 600) #background(0) def draw(): background(0) global x while x < width: fill(255) noStroke() ellipse(x, 20, 20, 20) x = x + 20 if someone knows it would be very useful, thanks :(:
@Majestic12zombies4 жыл бұрын
nevermind, for some reason the variable x should have been below draw function not above setup, i dont know why but it worked :)
@nenasaniatadaoaten58183 жыл бұрын
what if num1 = 3; num2 = 2; (num1 > num2) is this true ?
@johnnycincocero8 жыл бұрын
How can I turn these sketches into .gifs?
@TheCodingTrain8 жыл бұрын
+Johnny CincoCero I would take a look at saveFrame() which allows you save a sequence of images that you could stitch together into a GIF. processing.org/reference/saveFrame_.html
@johnnycincocero8 жыл бұрын
Thanks, Sir.
@Hydr3127 жыл бұрын
what is with the "do" loop ? how this work
@Smellycheecksyt4 жыл бұрын
I’m moving too fast 💨 😂
@angelcaru3 жыл бұрын
The difference is that the code in do...while(...) loops always executes at least once. For instance, while(false) {...} would never run, but do {...}while(false) would.
@7cmhg8406 жыл бұрын
Why is the subtitle in Portugese? Are you Portugese?
@made2youtv3365 жыл бұрын
want more video bout this plzzz
@kevinch36 жыл бұрын
Thank you smiley guy. When I can I will subscribe you
@artistalreem11806 жыл бұрын
Write a C++ programme that reads a sequence of integers terminated by zero value then finds the percentage of the negative numbers and the percentage of the positive number in the sequence. The programme output is as shown: : Enter a sequence of in integers terminated by zero 6 -7 -8 10 -12 14 15 2 -6 the percentage of negative numbers is 44.4 the percentage of positive numbers is 55.6
@dr__ey3 жыл бұрын
OMG I SCREAMED OUT LOUD WHEN I GOT 0 for mouseX omg
@farazk97293 жыл бұрын
Conquer the universe! Hahahaha!
@luisnannini8 жыл бұрын
deadmau5 - while(1
@caleblonggrear27965 жыл бұрын
/‘sjjkkkkkkkkmna kno n in
@angelcaru3 жыл бұрын
while(true);
@sidhuz6335 жыл бұрын
just ad x = x + mouseX + 1; there you go
@sidhuz6335 жыл бұрын
but add if condition is best because we need x = x + 1 for once only when mouseX
@rabeaahsan20706 жыл бұрын
cool
@ZoyaKhan-we8zi7 жыл бұрын
i need c compiler
@techgaming11255 жыл бұрын
Uh-huh!
@RealDTSM5 жыл бұрын
anyone here watching as a programming student? like if you are(not leeching likes i promise)