answersLogoWhite

0

What is while statement and how is it used?

Updated: 12/19/2022
User Avatar

Rhunter961

Lvl 1
8y ago

Best Answer

You use a while statement to introduce a conditional loop. Unlike a for loop which is typically used for counted loops, a while loop is used whenever a statement must iterate while an expression evaluates true. The expression is evaluated at the start of each iteration.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is while statement and how is it used?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is used to end a do loop?

A while statement.


What are control structures used in javascript?

The control structures used in java script are if-statement, for-loop, for-in loop, while loop,do-while loop, switch-statement, with-statement. try-catch-finally statements.


Why do you use semi colon in do while statement?

A semi-colon is used in a do while statement for the same reason that it is used in any other statement. The rules of C and C++, as well as Java, require that every statement be terminated with a semi-colon.


Can a question be a statement?

No, a question and a statement are two distinct types of sentences. A question is used to inquire about information while a statement is used to express a fact or opinion.


Can a continue statement be used in a switch statement?

If you have a loop in your switch statement or around your switch statement, you can use the continue statement in that. You cannot use a continue statement outside of a loop (do, for, or while).


When do you use rising and falling intonation for statement?

Rising intonation is used for questions or when seeking confirmation, while falling intonation is used for statements or declarations. Rising intonation at the end of a statement can signal uncertainty or a request for feedback, while falling intonation indicates finality or confidence in the statement being made.


Can a statement be a question?

what is the word used when a statement is written as a question?


What is the purpose of break statement in c?

The break statement exits control of the innermost for, while or do-while loop, or switch statement.


Why you use while function in c?

It is a statement; you can create a loop with it: while (<condition>) <statement>


What is the purpose do while statement differ from while statement?

In do while statement, no matter with condition at least one time true statement was run and then it ll check condition. When we need to run true block compulsory one time and then we want to check condition then do while statement useful rather than wile statement.


What is a dowhile statement in C programming?

"do statement while (...);" is a loop which does at least one iteration even if the condition after while is false. When, for instance, "while(...) statement" does not iterate at all if the condition after while is false.


How do you use continue statement in c language?

In C continue stements are used inside the loops like for .while,do while .its a statement used in c language wher it tell the compiler to skip the following statement(statement or part of progm following continue)&continue with next iteration.it shud me noted that its diff from break statement wher the control of prog goes out of the particular loop.in case of for ,while ,or do loops when we use continue the rest of the loop will not me excecuted and it will go back to check the condition of the loop.