Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
surajap123
Creator III

Do while loop

Hi All,


Please let me know the difference between 'do while' and 'for' loop.

-How 'Do while' loop different from 'FOR' loop?

-In what kind of requirements we use 'do while' loop instead of 'for' loop?

-Do we nest the do while loop in the for loop?

Thanks

6 Replies
Anil_Babu_Samineni

Are you expecting logic?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
adamdavi3s
Master

Taken from stackoverflow (these are standard programming tools which cover most languages)

A while loop will always evaluate the condition first.

while (condition) {

  //gets executed after condition is checked

}



A do/while loop will always execute the code in the do{} block first and then evaluate the condition.

do {

  //gets executed at least once

} while (condition);



A for loop allows you to initiate a counter variable, a check condition, and a way to increment your counter all in one line.

for (int x = 0; x < 100; x++) {

   //executed until x >= 100

}



Please remember to mark this as helpful or the correct answer if I have helped you or answered your question.

Anonymous
Not applicable

surajap123
Creator III
Author

‌@Manuel- The blog doesn't talk about while loop.

@Adam- Thanks for the informatio. Is the SYNTAX of all loop types in other programming language is same in Qlikview?

If yes, could you point me to some video tutorial that cover all loops.

Thanks

adamdavi3s
Master

Seriously google is your friend here along with the qlikview reference manual

http://help.qlik.com/en-US/qlikview/12.0/Content/Home.htm

surajap123
Creator III
Author

‌yes