Sha256: 9f365d0d331d60aab5a1a519582f090848c6087750c7de2440431550f11945d6

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

# Math test
module WhakamatautauPangarau
  # Mathematics. Start a maths test
  def pangarau
    puts 'Nau mai. Please type the answer in Teo Reo Maori (e.g "tahi" for 1) when prompted'
    tau1 = rand(100).to_i
    tau2 = rand(100).to_i
    whakautu_tika = tau1 + tau2
    puts "#{tau1.inspect} + #{tau2.inspect}?"
    whakautu = eval(gets).to_i
    if whakautu == whakautu_tika
      puts 'Ka pai. Correct!'
      ":)"
    else
      puts "Incorrect. You put '#{whakautu.inspect} (#{whakautu})'.
  Correct answer is '#{whakautu_tika.inspect} (#{whakautu_tika})'"
      ":("
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
te_reo_maori-0.1.8 lib/te_reo_maori/whakamatautau_pangarau.rb