var asciiSpace = [256]uint8{'\t': 1, '\n': 1, '\v': 1, '\f': 1, '\r': 1, ' ': 1}
how come we are allowed to have :1 in the code above and what is the meaning of that?
CodePudding user response:
asciiSpace
is declared an array of uint8
with indexes 0 .. 255 (i.e. the ASCII range), and the values for the indexed elements are set to 1
.
The array indexes are given as '\t'
, '\n'
etc. indicating they refer to whitespace characters.
My guess is you misinterpreted the sequence "index : value".
A similar example is given in a (randomly chosen) Go Tutorial.