You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for reporting this issue. But this is something I don't think I can change. TryRuby uses Opal for running Ruby in a web browser. Opal transpiles ruby to javascript. In javascript strings are immutable. Opal copies this behavior, see undocumented features.
I am in the process of updating the Opal version used by TryRuby. Using the latest Opal (0.11.4) the string indexing does work.
say = "I love Ruby"
say['love']
it returns 'love' as expected.
Starting irb with immutable strings (RUBYOPT=--enable-frozen-string-literal irb) and using your example will produce a similar error on the []= method.
https://ruby-doc.org/core-2.5.1/String.html#method-i-5B-5D-3D
expected
actual
this chunk of code is notably shown on ruby homepage
The text was updated successfully, but these errors were encountered: