Data Type and Variable declaration in Go (golang) 🔥🔥🔥

Опубликовано: 03 Ноябрь 2024
на канале: ThikHai
20
0

In this video you will learn, how you can declare variable, d/f way to declare Variable in Go Lang.

This Video also Help you to understand about Dynamic and Static Data Type.

In Go, variables are explicitly declared and used by the compiler to e.g. check type-correctness of function calls.

Example:
package main

import "fmt"

//Dynamic Data Type & Static Data Type

func main() {

var a1 = "apple"
fmt.Println(a1)

var a2 string = "apple"
fmt.Println(a2)

a3 := "apple"
fmt.Println(a3)

a3 = "apple2nd"
fmt.Println(a3)

var b, c int = 1, 2
fmt.Println(b, c)

var d = true
fmt.Println(d)

var e1 = 1
fmt.Println(e1)

var e2 int = 1
fmt.Println(e2)

e3 := 1
fmt.Println(e3)
}