3. "Return" instead of "print"


#1

Hi everyone,

This time I'm not stuck on that exercice but I'd like to better understand the following point:

def erreur_code
        return "Accès refusé : mauvais code !"
    end
end

vs.

def erreur_code
        print "Accès refusé : mauvais code !"
    end
end

Why can't we use print instead of return in this case ?
Thanks !


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.