In Ruby, you can check if a number is present in an array using the include? method. Here's an example:
main.rb139 chars9 linesThis will output:
main.rb18 chars2 lines
Alternatively, you can also use the include? method directly in a conditional statement like this:
main.rb134 chars9 linesThis will produce the same output as the previous example.
gistlibby LogSnag