Home > database >  What is the traceback/local jumpback error in irb repl when writing multiline code?
What is the traceback/local jumpback error in irb repl when writing multiline code?

Time:10-22

I am a newbie, forgive if this is an obvious question but does anyone know why my irb repl isn't able to do multilines? I have tried lots of different if statements (copied from course notes that I am doing - but not copied and pasted just typed) and I get this traceback message every time.

enter image description here

Will be grateful for advice!

CodePudding user response:

I've just read in the notes that this is due to doing a return that isn't in a method. It might become clearer later on.

Also, just copying this answer that was added as a comment so other people see it. Removing the 'return' works:

"While there are reasons to use the return keyword in ruby, if you are just learning start out by never typing this word. Ruby will always return the last statement executed, so just rely on this fact for now and structure your programming around it."

  • Related