refactor: 6th section first two lectures exercises and questions

This commit is contained in:
Inanc Gumus
2018-10-22 22:00:34 +03:00
parent 2e650b9a1e
commit 411be187ab
33 changed files with 114 additions and 49 deletions

View File

@ -0,0 +1,43 @@
// 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: Declare with bits
//
// 1. Declare a few variables using the following types
// int
// int8
// int16
// int32
// int64
// float32
// float64
// complex64
// complex128
// bool
// string
// rune
// byte
//
// 2. Observe their output
//
// 3. After you've done, check out the solution
// and read the comments there
//
// EXPECTED OUTPUT
// 0 0 0 0 0 0 0 false 0 0
// ""
// ---------------------------------------------------------
func main() {
// var i int
// var i8 int8
// CONTINUE FROM HERE....
}

View File

@ -0,0 +1,40 @@
// 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
import "fmt"
func main() {
// integer types
var i int
var i8 int8
var i16 int16
var i32 int32
var i64 int64
// float types
var f32 float32
var f64 float64
// bool type
var b bool
// string types
var s string
var r rune // also a numeric type
var by byte // also a numeric type
fmt.Println(
i, i8, i16, i32, i64,
f32, f64,
b, r, by,
)
// You could do it with Println as well
fmt.Printf("%q\n", s)
}