Skip to content

Slicing a string literal #537

@elliottc

Description

@elliottc

go 1.21, expr 1.15.8

I noticed slicing a string literal is giving an error:

"hello"[1:3]

unexpected token Bracket("[") (3:8)

But slicing a string variable works:

let s = "hello"; s[1:3]

"el"

I was hoping they would give the same output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions