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:
- Define the package name:
package main
- Import the required packages:
import "fmt"
- Create a main() function:
func main() {
- Declare and initialize a string variable for the given name:
firstName := "Bob"
- Declare and initialize a string variable for the family name:
familyName := "Smith"
- Declare and initialize an int variable for age:
age := 34
- Declare and initialize a bool variable for peanutAllergy:
peanutAllergy := false
- 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.