Repeat expression [n] times?

What I’m wondering is if there is some sort of loop in TiddlyWiki?
Like repeat a calculation until a variable is below a defined value? Or repeat until it is over a defined value?

There are operators which enable checking a value of other filter operations (e.g. the compare operator) but I have no good idea for not executing other parts when the condition is fulfilled.

Sorry for the lack of a precise example but this is something what came to my mind several times before I found other ways to solve my problem (without looping).

There are lots of different ways to create “loops” in tiddlywiki but the main one we use is filters. Filters will generate a list of titles/tiddlers that meet a particular set of conditions. You can then “iterate” the list using say a “list widget filter attribute”. The loop does not need an exit test, because it exits automatically when the list is exhausted.

  • So rather than loops, we tend to talk about lists or sets in tiddlywiki.
  • You use this in the original filter, to limit the resulting list of titles passed into the listing process, or out of the filter.

If you really have a number and want to list something N times consider the range operator, which can accept parameters [range<first>,<last>,<step>] where each is a variable (or literal).

  • However in this case you need to make sure that every number this generates, is valid when it comes to the content of your list widget.
2 Likes

18 posts were split to a new topic: Repeat expression [n] times? A Recursive Experiment

@TW_Tones - I suspected that lists are the answer could be the answer for my question. Thanks to your reply I’m now sure of.
Being honest I didn’t notice the range operator before, but it is indeed a real useful operator for some of my cases. Thanks for pointing this out!

Although I’m now used to the syntax in TiddlyWiki, I’m still far away to solve each idea/problem on my own. I’m overwhelmed by the documentation, where almost every single feature is well documented. But on the other hand it is the sheer amount of articles which hits me, making it very hard to find out what I really need. There are some very good central themes which leads you, like “Filters”.

What I wish for if there could be some cross references, which points to other operators with the same functioniality. e.g. ‘counter’ and ‘range’ in both articles or ‘then’/‘else’ operator and ‘conditional shortcuts’. Like it is linked in the ‘split’ article (refers to ‘join’). For better readibility I would put this in a footnote, e.g. "similar functions/operators’.
This would speed up the learning curve for beginners.

I’m afraid that this is not easy to accomplish, but I’m certain that this would be a really useful feature for the documentation.

1 Like

Addendum:
I noticed that some articles do already have cross references, like the uppercase-Operator, which points to lowercase Operator, uppercase Operator, titlecase Operator.

Excellent! Is this the new documentation style?
I really like it, thank you!

1 Like

This is a great idea but as an open source community we ask members to help develop the documentation, so please plan to do so yourself one day.

  • see the documentation Forum here, or edit a tiddlywiki.com tiddler for some guidance.
  • That is a common story but so too is overcoming this. The first step is to stop telling yourself a story a younger more impressionable you said. I did this decades ago and whist I never became a math wizz, I enjoy a little dabbling now.
1 Like

Good suggestion, I’ll think about it when I’m more familiar with TiddlyWiki. Although I have made good progress in the last weeks and months, there is still a lot for me to learn.
You don’t really want me to edit the documentation with my current spotty knowledge :sweat_smile:

You are right! It’s time to forget the old bad basics and start again with maths.
Due to my lack of free time, it’s a low priority at the moment, but I’ll stop rehashing the old story of traumatic experiences.