‫The for loop in Java is a versatile and commonly used loop that allows you to repeat a block of code
‫a specified number of times.
‫It's particularly useful when you know in advance how many times you want the loop to execute.
‫The for loop consists of three main parts the initialization condition and update all separated by semicolon.
‫The basic syntax of the for loop starts with for with a small letter.
‫This is the keyword of for loop.
‫The initialization.
‫I want from you to write down this.
‫Note the syntax condition and the update.
‫And here you specify the code to be executed repeatedly.
‫Let's start with.
‫INT I equal to one.
‫I'm creating an integer here in the initialization part of the for loop, creating an integer I equal
‫to one.
‫The second part is the condition I'm specifying here.
‫The condition I less than or equal to five.
‫The condition to be true I should be I less than or equal to five.
‫The update how we should update the loop and the condition I plus plus which which is increasing I by
‫one.
‫So I will be updated and increased by one after each iteration of the for loop.
‫So to be executed repeatedly, I need to print out the value of I.
‫Let's run the program.
‫And the result is one, two, three, four and five.
‫So again guys, I equal to one or int I equal to one is the initialization part where we declare and
‫initialize a variable I with the variable one.
‫I is less than or equal to five is the condition part which specifies the condition for the for loop
‫to continue as long as I is less than or equal to five.
‫The loop will continue executing.
‫I plus plus is the update part which increments the value of I by one after each iteration.