ASCII control characters: Difference between revisions

Added Go
(Converted to a draft task (see talk page).)
(Added Go)
Line 150:
<pre> D
7F</pre>
 
=={{header|Go}}==
Go's support for enums is unconventional in that they are basically a bunch of constants with which a type name may be associated.
 
The pre-declared identifier 'iota' is typically used with enums and represents successive untyped integer constants, starting from zero though (as here) the sequence may be interrupted by assigning a new value.
<syntaxhighlight lang="go">package main
 
import "fmt"
 
type Ctrl int
 
const (
nul Ctrl = iota
soh
stx
etx
eot
enq
ack
bel
bs
ht
lf
vt
ff
cr
so
si
dle
dc1
dc2
dc3
dc4
nak
syn
etb
can
em
sub
esc
fs
gs
rs
us
space
del = 127
)
 
func main() {
// print some specimen values
fmt.Println(cr)
fmt.Println(del)
}</syntaxhighlight>
 
{{out}}
<pre>
13
127
</pre>
 
=={{Header|perl}}==
9,482

edits