Yes, the is possible to develop a while loop that determines once the document has been ended. The while loop continues its execution till the specified problem is true. Once the problem turns come false the loop ended and also stop that execution. If the if expression worth becomes false the execution of the body will certainly not run even a single time. We can write many statements in ~ the while loop by applying the curly braces on multiple statements to represent the body of the loop.

Syntax:

While( condition)// statements come execute

Example:

Let's see an example, we desire to publish the also numbers indigenous 1 to 10 making use of the when loop. In PHP we will certainly write as;

Output:2, 4, 6, 8, 10

Explanation:

The over while loop continues to print the number if the number is even and also skip the number if the number is odd due to the fact that we need to write only even numbers. The while loop will protect against working as soon as the worth of ns will end up being 11 and also the problem becomes false. So, we can say the while the loop always determines as soon as the loop ended.




You are watching: It is possible to create a while loop that determines when the end of a file has been reached.

comment

Please log in or register to include a comment.


More Posts




See more: If This Connection Is Maintained For 1 Min, How Much Energy Is Transferred To The Dead Battery?

Write a statement to collection the worth of num come 4 (num is a variable that has already been declared).Farkhanda Athar - Apr 11, 2020
How to an outbreak of a when loop javaHasnain_khan - Oct 11, 2020
When a program lets the user understand that an invalid choice has to be made, this is known as;Farkhanda Athar - Aug 24, 2020
When this is inserted in prior of a change name, it return the address of the variable.Hiba Waqar - Jun 12, 2020
*
Can you have actually a if loop inside if condition?Lalit Kumar - Oct 11, 2020
How to produce a CSV record using php and also save it into a directory.Farkhanda Athar - may 6, 2020
*
create a loop in javascriptahsanhanif99 - Aug 31
Error: reached end of paper while parsingHasnain_khan - Oct 12, 2020
When the last value of one expression is assigned come a variable, it will be converted to:Hiba Waqar - Jun 12, 2020
*
While Loop in JavaYogesh Sharma - Aug 22