11

Accessing multiple indexes of an array

Suppose array %alphabet contains the values a,b,c,d,e. Currently if I want to access the first, third, and fifth I could write %alphabet(1) %alphabet(3) %alphabet(5), but this is a bit cumbersome as the number of entries I want increases.

Some programming languages offer the ability to access multiple array indexes in one function, in Tasker this would look something like this:

%alphabet(1,3,5)
--> evaluates to a,c,e

This would be especially useful when searching for array matches using %var(#?pattern) - you could use %var(%var(#?pattern)) to instantly get all members of %var() which match pattern.

1 reply

I like it, but I think for the special case of filtering an array based on its own values (your last example) a nicer syntax is warranted.