Backtick and apostrophe in error message

Hi,

I’m a little puzzled why error messages use backtick and apostrophe at
the same time.

For example:

prog.rb:1:in <main>': undefined local variable or methodfoo’ for
main:Object (NameError)

here, before the “” and “foo” is a backtick(`), after it is an
apostrophe(’), what’s the meaning of this?

Joey Z. wrote in post #1003059:

Hi,

I’m a little puzzled why error messages use backtick and apostrophe at
the same time.

For example:

prog.rb:1:in <main>': undefined local variable or methodfoo’ for
main:Object (NameError)

here, before the “” and “foo” is a backtick(`), after it is an
apostrophe(’), what’s the meaning of this?

To distinguish between an opening quote and a closing quote. The
reasons for why they need to be different, I don’t know.

Joey Z. wrote in post #1003059:

Hi,

I’m a little puzzled why error messages use backtick and apostrophe at
the same time.

For example:

prog.rb:1:in <main>': undefined local variable or methodfoo’ for
main:Object (NameError)

here, before the “” and “foo” is a backtick(`), after it is an
apostrophe(’), what’s the meaning of this?

These are simply typographical quotes or “smart quotes” and are supposed
to look better, like 66’s and 99’s for double quotes.

It can be annoying when copy-pasting though, if all you want is regular
string quotes.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs