Appendix

About

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

Solution:

  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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.