Difference Between For Loop & While Loop | Learn in 60 Seconds! #loop #forloop #whileloop #coding

Join our Live 4 Month Job-Ready BOOTCAMPS: Full Stack Development – Build web apps from scratch https://www.errormakesclever.com/fullstack-course?source=...

Difference Between For Loop & While Loop | Learn in 60 Seconds! #loop #forloop #whileloop #coding
Error Makes Clever
460.7K views • Apr 11, 2025
Difference Between For Loop & While Loop | Learn in 60 Seconds! #loop #forloop #whileloop #coding

About this video

Join our Live 4 Month Job-Ready BOOTCAMPS:

Full Stack Development – Build web apps from scratch
https://www.errormakesclever.com/fullstack-course?source=FSD_YT_Organic

DevOps with AWS– Learn automation, CI/CD & cloud deployment
https://www.errormakesclever.com/devops?source=Devops_YT_Organic

UI/UX Design – Master design thinking & user experience
https://www.errormakesclever.com/ui-ux?source=UIUX_YT_Organic

Understanding Loops: For Loop vs While Loop

Let's start with A Dosa Story

My brother and I went out for dosa one evening.
He confidently ordered 3 dosas upfront, knowing exactly how many he wanted.
I, on the other hand, ordered one at a time, eating and then deciding if I wanted another — until I, too, stopped at 3.

Now, let’s map this to coding logic:
➡️ My brother is a For Loop.
He knew the count already and repeated the action (eating dosa) for a set number of times.
It was structured, controlled, and predictable.

➡️ I represent a While Loop.
I didn’t decide the limit at the beginning. I kept going while I was hungry — the stopping condition was dynamic.
The process depended on checking a condition after each round (each dosa).

This simple dosa experience perfectly illustrates the key difference:
🔹 For Loop: Used when you know in advance how many times to repeat.
🔹 While Loop: Used when repetition depends on a condition being true.

Both loops are essential, just like both of us needed 3 dosas — but the approach was different!

Programming concepts become easier when we relate them to real-life stories.
This is how we teach at Error Makes Clever — through logic, simplicity, and everyday analogies.

💡 Follow us for more relatable coding concepts and tech insights!To know more watch the full video & Stay tuned here for the tech insights

Follow us on Instagram : https://www.instagram.com/errormakesclever/?hl=en

Follow us on linkedin : https://www.linkedin.com/company/errormakesclever

Follow us on facebook : https://www.facebook.com/errormakesclever/

Subscribe : https://www.youtube.com/@ErrorMakesClever

Website: https://www.errormakesclever.com/
#coding #forloop #whileloop #loop #code

Video Information

Views

460.7K

Likes

19.9K

Duration

0:56

Published

Apr 11, 2025

User Reviews

4.8
(92)
Rate:

Related Trending Topics

LIVE TRENDS

Related trending topics. Click any trend to explore more videos.

Trending Now