Complete the code to declare a module named MyModule.
module [1] # module content end
The module name should start with a capital letter and be a valid constant name. MyModule is the correct module name.
Complete the code to define a method inside the module.
module Greetings def self.[1] puts 'Hello!' end end
Method names should be lowercase with underscores. say_hello is a proper method name.
Fix the error in the module declaration syntax.
module [1] def greet puts 'Hi!' end end
Module names must be constants starting with a capital letter. GreetModule is correct.
Fill both blanks to create a module with a constant and a method.
module [1] VERSION = '1.0' def self.[2] puts "Version: #{VERSION}" end end
The module name AppInfo follows Ruby conventions. The method show_version is a clear descriptive method name.
Fill all three blanks to define a nested module with a method.
module [1] module [2] def self.[3] puts 'Nested module method' end end end
Module names OuterModule and InnerModule use proper CamelCase. The method nested_method uses snake_case.