Variables and Data Types in Go
In Go, you declare a variable using the var keyword followed by the variable name, the variable type, and optionally, an initial value.
var a int // declare an integer variable
a = 42 // assign a value to the variable
var b float64 = 3.14 // declare and initialize a float64 variable
Go supports several built-in data types, including integers, floats, booleans, and strings.
No comments:
Post a Comment