与えられたlet ra = ResizeArray<int> ()
:
Seq.forall (fun i ->
let q = i % 2
if 0 = q then ra.Add i
true ) <| seq { 1..10 }
私がそれを行うと、ra.Count
が返されます5
。
Seq.forall (fun i ->
let q = i % 2
if 0 = q then ra.Add i
0 = q ) <| seq { 1..10 }
私がそれを行うと、ra.Count
が返されます0
。
では、ラムダ関数のすべての反復が true と評価されない限り、関数内のコードは実質的に実行されません。
何が起きてる?