Skip to content

ForRange

Name Mandatory Description Default Type
⬅️ Input The input value is not used and will pass through unchanged. Any
Output ➡️ The output of this shard will be its input. Any
From No The initial iteration value (inclusive). 0 Int&Int
To No The final iteration value (inclusive). 1 Int&Int
Action No The action to perform at each iteration. The current iteration value will be passed as input. None Shard[Shard]None

Executes a series of shards while an iteration value is within a specified range.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
;; Sum all positive integers below 1000
0 >= sum

ForRange(
  From: 1
  To: 999
  Action: {
    Math.Add(sum) > sum ; ; 1 then 2 then 3 then .... 999 is passsed as input
    Log
  }
)

sum | Assert.Is(499500 true)