Saturday, April 22, 2023

R Tutorial Playlist - While loop

 While loop is used in cases when you have to iterate through some process unknown number of times.

while(TRUE){

    'process'

}

or

while(a>10){

    'process'

}

In the first case, condition is TRUE, so this loop would run indefinitely unless we provide command break in its process scope. In second case, we have statement as condition; now, you can provide any statement in  between condition brackets as long its product is TRUE or FALSE.

Finally, this loop is going to run as long condition that keeps it running is TRUE.

For video tutorial, check the link below.



No comments:

Post a Comment