F# break from while loop

后端 未结 7 2080
甜味超标
甜味超标 2021-02-18 14:30

There is any way to do it like C/C#?

For example (C# style)

for (int i = 0; i < 100; i++)
{
   if (I == 66)
       break;
} 
相关标签:
7条回答
  • For these kind of problems you could use a recursive function.

    let rec IfEqualsNumber start finish num =
        if start = finish then false
        elif 
          start = num then true
        else
          let start2 = start + 1
          IfEqualsNumber start2 finish num
    
    0 讨论(0)
提交回复
热议问题