1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Declare Arrays and Slices in Go

    goGo

    There are numerous ways that you can declare and create arrays and slices in Go. This lesson will show you several and I talk about the advantages and disadvantages of one over another. After watching, you will better understand all of the possible ways you can declare/create as well as the idiomatic way.

    These include:

    • var
    • the built-in function new
    • the built-in function make
    • Array and Slice literals

    While it is not the main intent of this lesson, I do touch on some of the differences between slices and arrays.

    Checkout the code in my github repo.