Skip to content

NoMethodError error for String#[]= #26

Closed
@razum2um

Description

@razum2um

https://ruby-doc.org/core-2.5.1/String.html#method-i-5B-5D-3D

say = "I love Ruby"
say['love'] = "*love*"
say

expected

I *love* Ruby

actual

NoMethodError: undefined method `[]=' for "I love Ruby"

this chunk of code is notably shown on ruby homepage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions