This section is included to assist the students to perform the activities present in the book. It includes detailed steps that are to be performed by the students to complete and achieve the objectives of the book.

1. Variables and Operators

Activity 1.01 Defining and Printing


  1. Define the package name:

    package main

  2. Import the required packages:

    import "fmt"

  3. Create a main() function:

    func main() {

  4. Declare and initialize a string variable for the given name:

      firstName := "Bob"

  5. Declare and initialize a string variable for the family name:

      familyName := "Smith"

  6. Declare and initialize an int variable for age:

      age := 34

  7. Declare and initialize a bool variable for peanutAllergy:

      peanutAllergy := false

  8. Print each variable ...

Get The Go Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.