ruby - undefined local variable or method ` ' for main:Object -



ruby - undefined local variable or method ` ' for main:Object -

sometimes, next causes unusual bug:

> nil || 4 nameerror: undefined local variable or method ` 4' main:object > nil || [] nameerror: undefined local variable or method ` ' main:object

what reason?

you accidentally typing alt + space on mac, produces non-breaking space. ruby not consider whitespace, part of variable name. complains variable not exist.

some people remap alt + space space in order prevent typo.

i highlight invisible characters in text editor, notice typo immediately.

ruby whitespace

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -