Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 800 Bytes

exercise.md

File metadata and controls

45 lines (29 loc) · 800 Bytes

Variables

Objectives

  1. Write a Go program that will store the values of your name and age in variables (or constants), and will print the following sentence using the variables you defined: My name is ___ and I'm ___ years old

  2. Explain why the following program will fail?

package main import"fmt"funcmain() { fmt.Println("Skynet Beta Testing") varobjective="Defend Humanity" }
  1. What's the output of the following program?
package main import"fmt"funcmain() { constsquares=2varcircles=0fmt.Println("Squares:", squares) fmt.Println("Circles:", circles) squares=1circles=7fmt.Println("Squares:", squares) fmt.Println("Circles:", circles) }

Solution

Click here to view the solution

close