Skip to Main Content
The Go Workshop
book

The Go Workshop

by Delio D'Anna, Andrew Hayes, Sam Hennessy, Jeremy Leasor, Gobin Sougrakpam, Dániel Szabó, Philipp Mieden, David Parker, Gwenn Etourneau, Arpit Aggarwal, Eugene Wang
December 2019
Beginner content levelBeginner
824 pages
14h 36m
English
Packt Publishing
Content preview from The Go Workshop

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Writing, Presenting, and Communicating with Confidence

Writing, Presenting, and Communicating with Confidence

Harvard Business Review
Become a Better Problem Solver by Telling Better Stories

Become a Better Problem Solver by Telling Better Stories

Arnaud Chevallier, Albrecht Enders, Jean-Louis Barsoux

Publisher Resources

ISBN: 9781838647940Supplemental Content