Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the three methods of programming out of the loop in Scala?

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you what are the three ways to program out of the cycle in Scala. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Control variables based on boolean type

Package com.unicom.ljs.learning/** * @ author: Created By lujisen * @ company ChinaUnicom Software JiNan * @ date: 2020-02-01 22:15 * @ version: v1.0 * @ description: com.unicom.ljs.learning * / object IteratorTest {def main (args: Array [String]): Unit = {var flag = true var count = 0 var n = 0 while (flag) {count + = n N + = 2 println ("count =" + count) println ("n =" + n) if (n = 8) {flag = false}

two。 Nested functions use return

Package com.unicom.ljs.learning

/ * * @ author: Created By lujisen * @ company ChinaUnicom Software JiNan * @ date: 2020-02-01 22:15 * @ version: v1.0 * @ description: com.unicom.ljs.learning * / object IteratorTest {def main (args: Array [String]): Unit = {println (func1 ())}

Def func1 () = {var result=0 def func2 (): Any = {for (I)

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report