Data Type

  1. Difference Between := and =

:= used for variable declaration and inisialisation, while "=" used only for variable declaration.

package main

import "fmt"

func main() {
    a := 5
    fmt.Println(a)

    var b int
    b = 3
    fmt.Println(b)
}
  1. Convert Float to Integer

package main

import "fmt"

func main() {
    a := 5.5
    fmt.Println(int(a))
}
  1. Check Variable Type

  1. Concatenate String

Last updated