Update 'Style Guide'
parent
ce730ad4d5
commit
eb3058c005
@ -144,7 +144,7 @@ Other stylistic choices don't matter as much, since all of the code will be gofm
|
|||||||
|
|
||||||
# "Enums"
|
# "Enums"
|
||||||
|
|
||||||
Go does not have support for enums, but you can still make things that are effectively enums. This is done by creating a new type with the desired name, and basing it off of an `int` primitive, then definind a `const` block of pre-defined values for it.
|
Go does not have support for enums, but you can still make things that are effectively enums. This is done by creating a new type with the desired name, and basing it off of an `int` primitive, then defining a `const` block of pre-defined values for it.
|
||||||
|
|
||||||
```
|
```
|
||||||
type Color int
|
type Color int
|
||||||
@ -157,3 +157,5 @@ const (
|
|||||||
```
|
```
|
||||||
|
|
||||||
All enum values the ARF compiler are prefixed with the name of the enum they belong to, as shown above.
|
All enum values the ARF compiler are prefixed with the name of the enum they belong to, as shown above.
|
||||||
|
|
||||||
|
The `iota` keyword just initializes everything in the block with incrementing values.
|
Reference in New Issue
Block a user