For ... Until Loop #8

sbrinkmann opened this Issue May 26, 2012 · 5 comments


None yet
3 participants

A loop which goes trough a defined amount of numbers, would be very helpful.

A simple example

 {for number from 0 until 10}

More complex example with stepwidth

 {for number from 0 until 10 step 2}

You can probably implement this using synchronous functions and the existing foreach construct:

{foreach x in @range(0, 10)}

where the range function looks something like:

function range(from, to) {
var r = [];
for (var i = from; i < to; i++) {
return r;

You could even add logic for an optional step parameter with a few extra lines of code.

Does that work?

I did'nt know that synchronous are methods are also implemented and that I can call them within the foreach loop. I will try, if this acceptable for me.

On the other hand would you merge my change into you library if I implement a loop functionality as it is shown in my first post above?

It feels unnecessarily heavy-handed to add extra syntax to the language to support this, but if @cliffano or @nomiddlename have any strong opinions here I might be swayed.

On the other hand, if you're keen to simply contribute to the language I can think of some small missing features in jazz that might make good first bugs?

I'd say a library of standard functions (and some documentation of examples like the above) would be better than extra keywords.

Mind you, I'm still reeling from the idea that someone else is using jazz :)

Haha. Makes two of us! ;)

@sbrinkmann sbrinkmann closed this Jul 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment