Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (22 sloc) 360 Bytes
package main
import (
"fmt"
)
func main() {
c := '&'
// this would fail with the default branch
// delete the leading // to try this out
// c = 'a'
switch c {
case '&':
fmt.Println("&")
case '<':
fmt.Println("&lt;")
case '>':
fmt.Println("&gt;")
case '"':
fmt.Println("&quot;")
default:
panic("unrecognized escape character")
}
}
You can’t perform that action at this time.