This time, we will use the while statement to create an example sentence. The while statement is a conditional expression that repeats processing
boolean alarm = true;//Substitute true or false here
while (alarm) {
System.out.println("Press the refresh button");
System.out.println("Wait 3 minutes");
}
By the way, if you execute this process, you will end up in an infinite loop. Also, if false, nothing is displayed.
--You can control ** repetition ** with the command while. (while means between) --Write a condition to continue the repetition in () of while ――As long as the condition to continue repeating is satisfied, it will be executed repeatedly as many times as you like. (Therefore, be careful of infinite loops !!)
If and while are called control syntax. The control syntax consists of two components, a "conditional expression" and a "block".
Reference diagram
if("Conditional expression"){
//block
} else {
//block
}
while("Conditional expression"){
//block
}
――In a loop, if you don't think about the processing carefully, you will get hooked on an infinite loop. --Use while to repeat. ――Next time about blocks
That's all for today ... The pace of progress is slowing down, but if you do it any faster, you will get a flat tire. \ (^ O ^) / Qiita is fun! You can enjoy studying, and you can comment and edit such study notes (^ o ^) Tomorrow is Saturday, but can I update at work and drinking party ... Even so, I'm wondering if the name of the class will also ask for a sense, and I'm thinking of studying English in parallel for the first time in a while, so I have to find some good text in the bookstore (´ ・ ω ・ `) The only English book I have now is ** junior high school English ** where my sister can't be so cute and I'll start over ** (There was a series like Haruhi, but I wonder if that is the same place ...)
Recommended Posts