Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubymethod lookup and ancestorsSingle-choice MCQ

Lexical scope and the inheritance chain disagree about a constant's value. Which one wins when the constant is referenced inside a method?

module Lex CONST = "lexical" end class Anc CONST = "ancestor" end module Lex class Child < Anc def find; CONST; end end end p Lex::Child.new.find