R
Rosina Bignall
Let's say you have an array which might contain:
colors = ["black","white","red","yellow","green"]
And you'd like to see the first three elements with a ... attached to
the end if there are more than 3.
"colors[0,2].join(', ') + ' ...' if colors.count > 3"
Which of course is blank in there are less than 3 elements in the array.
How do I limit the if to only working on the ' ...' part?
Sorry for the newbie question, but I have no idea what to even look for
in the docs.
Thanks!
colors = ["black","white","red","yellow","green"]
And you'd like to see the first three elements with a ... attached to
the end if there are more than 3.
"colors[0,2].join(', ') + ' ...' if colors.count > 3"
Which of course is blank in there are less than 3 elements in the array.
How do I limit the if to only working on the ' ...' part?
Sorry for the newbie question, but I have no idea what to even look for
in the docs.
Thanks!