In GO programmers use camel case for names so things like ‘CamelCase’ or ‘camelCase’ but not ‘camel_case’.
| name | type | syntax | example |
|---|---|---|---|
| var | variable | var name type = expression | var myVar int = 5 |
| const | constant | const name type = expression | const myVar string = “something” |
| type | |||
| func | function | func name (input_type) output_type { } |
| name | type | example |
|---|---|---|
| int | integer number | 25 |
| float64 | long 64 bit decimal | 1.01234 |
| string | string | “some string” |
| bool | boolean | true |
var i, j, k int
const myConstant string = "some constant"
var b, f, g = true, 2.3, "text"
these are very common although they can only be used inside a function and not globals.
variableName := "expression"
functions in GO can return more then one value thus declarations are flexible for that too.
f, g := os.Open(name)
so in the above example f & g are both declared and assigned in one line simply. sadf
you can use the godoc <pkg> command to get help on that package