Lava Example - 61 | Rock Community

Lava Example - 37


Prompt

Now we're defining an array in the template itself, so you can change the values if you want to. Initially it contains a list of fruits. (Isn't that nuts?)

Practice sorting this array using Sort versus SortNatural.

Then un-sort them so they're in a random order. Click "Run" multiple times to watch them move around!

Initial Code
{% assign fruits = 'Banana,orange,apple,pear' | Split:',' %}
Solution Lava
{% assign fruits = 'Banana,orange,apple,pear' | Split:',' %}

{{ fruits | Sort | Join:', ' }}<br>
{{ fruits | SortNatural | Join:', ' }}<br>
{{ fruits | Shuffle | Join:', ' }}