Need 'return' statement following 'fail' call in a Ruby method? -


i got following code rails tutorial:

def do_something     # code here....      if @user.blank?         fail notauthenticatederror         return     end      # more code here... end 

is return statement necessary, or fail call sufficient stop rest of code in method running? perhaps depends on how notauthenticatederror handled?

no, don't need return.

def do_something     puts "start"     fail notauthenticatederror     puts "this doesn't print" end 

that code never last line.

check out:

what-does-the-fail-keyword-do-in-ruby


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -