In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to realize the infinite loop of Scala". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to realize the infinite loop of Scala".
Sometimes, we may need to execute the same piece of code multiple times. In general, statements are executed sequentially: the first statement in the function is executed first, then the second statement, and so on.
Programming languages provide a variety of control structures for more complex execution paths.
Loop statements allow us to execute a statement or group of statements multiple times. Here is a flowchart of loop statements in most programming languages:
Cycle type
The Scala language provides the following loop types. Click the link to view the details of each type.
The loop type describes that the while loop runs a series of statements that, if the condition is true, are repeated until the condition becomes false. A do...while loop is similar to a while statement except that a block of code that executes a loop before determining the condition of the loop. The for loop is used to repeat a series of statements until certain conditions are met, usually by increasing the value of the counter after each loop is completed. Loop control statement
Loop control statements change the order in which your code is executed, through which you can jump the code.
Infinite cycle
If the condition is always true, the loop becomes an infinite loop. We can use the while statement to implement an infinite loop:
Object Test {
Def main (args: Array [String]) {
Var a = 10
/ / Infinite Loop
While (true) {
Println (value of "an is:" + a)
}
}
}
At this point, I believe you have a deeper understanding of "how to achieve the infinite loop of Scala". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Types and methods of software testing
© 2024 shulou.com SLNews company. All rights reserved.