4. Go Array Basics

Arrays are a data structure with a fixed size and type.


Creating arrays:

var VARIABLE_NAME = [INT]TYPE{}

var bag = [10]string{}


Sample:

package main

import "fmt"

type tables struct {
    name string

    age int64

    cash int64
}

var arrays = [5]tables{}

var intarray = [5]int{}

var stringarray = [5]string{}

// var variable [indexlimit]type{values}

// var variable [...]type{values}

func main() {

    arrays[0] = tables{"bob", 64, 300}

    fmt.Println(array[0].age)

}





Comments

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort