diff options
| author | dam <dam@gudinoff> | 2023-03-27 23:49:08 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2023-03-27 23:49:08 +0100 |
| commit | 93943539ab2c553d68677d273ca08b135006b09a (patch) | |
| tree | 517d43adf5e2d6a7b555495a962f8fd2c8c01e3b | |
| parent | e4bae939aea065fa5745e224fc0eb12d5136d1c4 (diff) | |
| download | task-time-tracker-93943539ab2c553d68677d273ca08b135006b09a.tar.zst task-time-tracker-93943539ab2c553d68677d273ca08b135006b09a.zip | |
Added step iterator.
| -rw-r--r-- | unused.jai | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -1,4 +1,32 @@ +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- // + + +Step_Iterator :: struct { + min: int; + max: int; + step: int; +} + +step_iterator :: (min: int, max: int, step: int) -> Step_Iterator { + return .{ min, max, step }; +} +for_expansion :: (iterator: Step_Iterator, body: Code, flags: For_Flags) #expand { + iteration_count: int; + for <=cast(bool)(flags & .REVERSE) i: iterator.min..iterator.max { + iteration_count += 1; + if iteration_count % iterator.step == 0 continue; + + `it := i; + `it_index := void; + + #insert body; + } +} + +for step_iterator(0, 10, 2) { + log("%", it); +} // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- // |
