📜  F#-循环

📅  最后修改于: 2020-11-21 06:37:14             🧑  作者: Mango


编程语言提供了各种控制结构,允许更复杂的执行路径。

循环语句使我们可以多次执行一个语句或一组语句,以下是大多数编程语言中循环语句的一般形式-

循环语句

F#提供了以下类型的循环来处理循环需求。

Sr.No Loop Type & Description
1

for… to and for… downto expressions

The for…to expression is used to iterate in a loop over a range of values of a loop variable. The for… downto expression reduces the value of loop variable.

2

for … in expression

This form of for loop is used to iterate over collections of items i.e., loops over collections and sequences

3

While…do loop

Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body.

4

nested loops

You can use one or more loop inside any other for or while loop.