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:
Comments
Post a Comment