Posts

Showing posts with the label data-types

Data Types in Go

Image
GOLang Data Types Data types are one of the key things one has to know about while learning a language. They constitute the base of any programming language. I will be covering major data types that any programmer would be using throughout the day while working with GO. Without wasting enough time lets start with GO data types. Basic Types int float32 float64 bool strings derived types Int Ints are used to store 32 or 64 bits integer values defined in GO as follows: var i int = 122 i:=122 The latter syntax is used when we want GO Compiler to pick the data type by inferring the value stored in the variable. Floats Floats are used to store decimal values in Go. Floats can be of two types float32 float64 These two types correspond to the amount of space 32 bytes and 64 bytes respectively to store the numeric values. floats can be created in Go using the following syntax: var f float32 = 1.1 var f64 float64 = 1.1 Bool Bo