Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output:

The three dogs are named Benjamin, Samba and Bernie.

For a language that is lettercase insensitive, we get the following output:

There is just one dog named Bernie.



Related task

 Unicode variable names


module FiveDogs
  dog = "Benjamin"
  dOg = "Dogley"
  doG = "Fido"
  Dog = "Samba"   # this constant is FiveDogs::Dog
  DOG = "Bernie"  # this constant is FiveDogs::DOG
 
  names = [dog, dOg, doG, Dog, DOG]
  names.uniq!
  puts "There are %d dogs named %s." % [names.length, names.join(", ")]
  puts
  puts "The local variables are %s." % local_variables.join(", ")
  puts "The constants are %s." % constants.join(", ")
end