Master FOR LOOPS in Minutes with This Video

preview_player
Показать описание
In this video, I'll be explaining what for loops are in Java. I'll explain the syntax- the Initialization, condition, and update and I'll explain how you can use a for loop to repeat an action a fixed number of times. As a bonus, I'll also explain while loops since both of them are quite similar- they're just arranged differently.

I personally like for loops since there is lesser chance for any syntax errors. I hope you like this video!

If you like the video or found it useful, I would love it if you can leave a like and subscribe. Thank you!

Timestamps:

0:00 - What are loops?
2:50 - For Loops and While loops
3:17 - The three components of Loops
5:25 - Intuition behind the syntax
11:16 - Control flow in a for loop
14:44 - Example program and explanation
Рекомендации по теме
Комментарии
Автор

I hope you enjoyed this video! As practice, try to solve this problem and comment your solution down below

Write a Java program to find the sum of the first 30 even numbers.

It's a simple question and it's a great one to understand for loops better.

Hint: If i take a variable "x" as 0, and i say x=x+ i (i is the iterator), every single iteration, i is added to x.
Hint 2: A value is even if it is divisible by 2. This means that the remainder when you divide it is 0 so the value%2 is equal to 0

LearnJava_Programming