# To create a module, you use the module keyword.
# You can place modules and the code that uses them in the same file, or break them out among separate files.
#file: mathematics.rb.
module Mathematics
def Mathematics.add(operand_one, operand_two)
return operand_one + operand_two
end
end
file: sentence.rb
module Sentence
def Sentence.add(word_one, word_two)
return word_one + "" + word_two
end
end
file: ModuleTest.rb
require 'mathematics'
require 'sentence'
puts "2 + 3 = " + Mathematics.add(2, 3).to_s
|