Tasker Tip Tuesdays

Tasker Tip Tuesdays: How to Create Variable Arrays

How To Create Variable Arrays

Welcome to Tasker Tip Tuesdays​, quick tips to help grow your Tasker knowledge.  This week I discuss how to create variable arrays.  If you need to create variable arrays to manipulate and process data you’ll love this useful tip.

Variable Arrays




Variable arrays are what Tasker refers to as arrays.  While not quite a true array, as other programming languages use, it does support something similar.  Pent describes them as “pseudo-arrays”.  These pseudo-arrays are basically values “just stored in Tasker in index’d positions” as stated by Reddit user /u/Rachet_Guy.  Well said Rachet!  But what about how to creating them?

[How To] Create Variable Arrays

As stated within Tasker’s userguide, variables section, there are five methods.  Each of which resulting in variable arrays:

  1. using Array Set:
    Array Set, %arr, a b c d
  2. using Variable Split on an existing (simple) variable:
    Variable Set %arr a b c d
    Variable Split %arr
  3. by assigning individual elements with Variable Set:
    Variable Set, %arr3, c.
  4. using Array Push to add an initial element
  5. some other actions also create arrays for their results e.g. List Files.

Examples

Now that you understand how to create variable arrays, let’s play around with some examples to get a better understanding.  Enjoy the video below as I provide examples for each of the above five methods.


Conclusion




In order to create variable arrays, just follow one of the above steps.  Then, manipulate them to your liking using variable array special syntax.

Further Reading

To catch up on previous posts in this series, visit the Tasker Tip Tuesdays page.  As ways, enjoy and keep learning!  Until the next Tasker Tip Tuesday…

What did you think???