Skip to content

Instantly share code, notes, and snippets.

@dnovais
Created August 31, 2023 03:15
Show Gist options
  • Save dnovais/e762b6e8c25d9a0ed53e7845ced1af57 to your computer and use it in GitHub Desktop.
Save dnovais/e762b6e8c25d9a0ed53e7845ced1af57 to your computer and use it in GitHub Desktop.
Simple Search Algorithm
list = [1, 2, 3, 4, 5, 6, 7, 30, 32, 12, 21, 22, 56, 70, 62]
list = list.sort
find = 21
list.each do |item|
puts "The number #{find} is here!" if item == find
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment