refactor: 6th section first two lectures exercises and questions
This commit is contained in:
27
06-variables/02-declarations/exercises/11-wrong-doer/main.go
Normal file
27
06-variables/02-declarations/exercises/11-wrong-doer/main.go
Normal file
@ -0,0 +1,27 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE: Wrong doer
|
||||
//
|
||||
// 1. Print a variable
|
||||
//
|
||||
// 2. Then declare it
|
||||
// (This means: Try to print it before its declaration)
|
||||
//
|
||||
// 3. Observe the error
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func main() {
|
||||
// First print it:
|
||||
// fmt.Println(?)
|
||||
|
||||
// Then declare it:
|
||||
// var ? ?
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
func main() {
|
||||
// UNCOMMENT THE CODE BELOW TO SEE THE ERROR
|
||||
|
||||
// fmt.Println(age)
|
||||
// var age int
|
||||
}
|
Reference in New Issue
Block a user