Day 2: Variables & Constants in Go

Variables

  • Variables are used to store values.

Constants

  • Once the value is stored cannot be replaced.

Sample Code

package main

import "fmt"

func main() {
    var conferenceName = "Go Conference"
    const conferenceTickets = 50
    var remainingTickets = 50
    fmt.Println("Welcome to", conferenceName, "booking application")
    fmt.Println("we have total of", conferenceTickets, "tickets and", remainingTickets, "are still Available")
    fmt.Println("Get your tickets to attend")
}