peelonet / tempearly

Minimal scripting language / templating engine.
2 stars 0 forks source link

Add support for `else` statement in `for` statement. #110

Closed RauliL closed 9 years ago

RauliL commented 9 years ago

This implements an idea I saw used in Jinja template engine: For loop which iterates over collections may have an else statement which executed only when the collection is empty. I think it's super handy dandy and should be included also in Tempearly.

Example of usage:

for element : some_collection:
    print(element);
else:
    print("The collection is empty.");
end for;