Comment by vidarh
18 days ago
The point was that logically it would be an array lookup by index.
There's no need for any conditional construct here whatsoever.
You'll note it has already constructed a string in the right order to do that, but then copped out with the if-else.
True enough. On that note, I had a look at the language reference - there's arrays - but also this:
So, you can pluck a character... From an UTF-8 string? What if the rendering used multibyte characters?
Well, we can see the string, and we can see that is uses plain ASCII.
In this case, sure. But what if we shifted to rendering with emojis or whatnot. What would the first ASCII character of the string be?
2 replies →