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


package dogs
 
import "fmt"
 
// Three variables, three different names.
// (It wouldn't compile if the compiler saw the variable names as the same.)
var dog = "Salt"
var Dog = "Pepper"
var DOG = "Mustard"
 
func PackageSees() map[*string]int {
    // Print dogs visible from here.
    fmt.Println("Package sees:", dog, Dog, DOG)
    // Return addresses of the variables visible from here.
    // The point of putting them in a map is that maps store only
    // unique keys, so it will end up with three items only if
    // the variables really represent different places in memory.
    return map[*string]int{&dog: 1, &Dog: 1, &DOG: 1}
}