Many languages support constructs like the following (Python, in this case):
>>> ["One", "two", "three"].join(" and ")
"One and two and three"
In Crystal, what is the idiomatic way to do this?
Many languages support constructs like the following (Python, in this case):
>>> ["One", "two", "three"].join(" and ")
"One and two and three"
In Crystal, what is the idiomatic way to do this?
Use #join
, which Array
inherits from Enumerable
. The example in the question works just as well in Crystal.