I will like to select a name randomly from an array list then display either in Capital or Lowercase
For example names= ["James", "John", "Jane"] Output should be: JOHN or john or jane or JAMES or JANE or james
Please help!
I have tried using the .sample() command which selects from an array. Also, I'm aware of the .upcase() and .lowercase(), the problem now is how to combine these whole methods together in order to get the desire result which is to select a name randomly for the array list then display in either Capital or Lowercase.
def random_case(*names)
names= ["James", "John", "Jane"]
names.sample { |names| names.upcase names.downcase }
puts "Hello #{names}! How are you today?"
end
random_case()
I expect the output to be JOHN or john or jane or JAMES or JANE or james - randomly