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

How to use for Loop statement nesting method

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

How to use for loop statement nesting method, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

For loop syntax:

For (expression 1; expression 2; expression 3)

{

Cyclic body

}

The loop starts with expression 1-expression 2 (discriminant expression)-true-execution loop body-expression 3-judgment expression 2

True: continue-loop body-expression 3-expression 2

False: jump out of the loop (normally, the exit of the for loop is expression 2)

Exercise: use the for loop to find the sum of 1-100?

The transformation form of for cycle

Loop factor: a, defined before the for loop, can still be used after the end of the for loop.

B. Within a defined for loop, after the for loop ends, you cannot use the

For (int I = 1; 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