Initial commit

This commit is contained in:
Inanc Gumus
2018-10-13 23:30:21 +03:00
commit cde4e6632c
567 changed files with 17896 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// 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
// 1- Declare and print a variable with an int type
// 2- The declared variable's name should be: height
//
// EXPECTED OUTPUT
// 0
// ---------------------------------------------------------
func main() {
// var ? ?
// ?
}

View File

@ -0,0 +1,18 @@
// 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() {
var height int
fmt.Println(height)
}

View File

@ -0,0 +1,22 @@
// 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
// ---------------------------------------------------------
// OPTIONAL EXERCISE
// 1- Declare and print a bool variable
// 2- The variable's name should be: isOn
//
// EXPECTED OUTPUT
// false
// ---------------------------------------------------------
func main() {
// var ? ?
// ?
}

View File

@ -0,0 +1,17 @@
// 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() {
var isOn bool
fmt.Println(isOn)
}

View File

@ -0,0 +1,22 @@
// 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
// 1- Declare and print a variable with a float64 type
// 2- The declared variable's name should be: brightness
//
// EXPECTED OUTPUT
// 0
// ---------------------------------------------------------
func main() {
// var ? ?
// ?
}

View File

@ -0,0 +1,18 @@
// 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() {
var brightness int
fmt.Println(brightness)
}

View File

@ -0,0 +1,28 @@
// 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
// 1- Declare a string variable
// 2- Print that variable
//
// EXPECTED OUTPUT
// ""
// ---------------------------------------------------------
func main() {
// USE THE BELOW CODE
// You'll learn about Printf later
// var ?
// fmt.Printf("s (%T): %q\n", s, s)
// %T prints the type of the value
// %q prints an empty string
}

View File

@ -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
import "fmt"
func main() {
var s string
fmt.Printf("s (%T): %q\n", s, s)
}

View File

@ -0,0 +1,33 @@
// 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
// 1- Declare the variables below:
// 3speed
// !speed
// spe?ed
// var
// func
// package
//
// 2- Observe the error messages
//
// NOTE
// The types of the variables are not important.
// ---------------------------------------------------------
func main() {
// var ? int
// var ? int
// var ? int
// var ? int
// var ? int
// var ? int
}

View File

@ -0,0 +1,17 @@
// 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() {
// var 3speed int
// var !speed int
// var spe?ed int
// var var int
// var func int
// var package int
}

View File

@ -0,0 +1,41 @@
// 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
// 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)
}

View File

@ -0,0 +1,32 @@
// 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
// 1. Declare two variables using
// multiple variable declaration statement
//
// 2. The first variable's name should be active
// 3. The second variable's name should be delta
//
// 4. Print them all
//
// HINT
// You should declare a bool and an int variable
//
// EXPECTED OUTPUT
// false 0
// ---------------------------------------------------------
func main() {
// var (
// ?
// )
// fmt.Println(active, delta)
}

View File

@ -0,0 +1,18 @@
// 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() {
var (
active bool
delta int
)
fmt.Println(active, delta)
}

View File

@ -0,0 +1,34 @@
// 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
// 1. Declare and initialize two string variables
// using multiple variable declaration
//
// 2. Use the type once while declaring the variables
//
// 3. The first variable's name should be firstName
// 4. The second variable's name should be lastName
//
// 5. Print them all
//
// EXPECTED OUTPUT
// "" ""
// ---------------------------------------------------------
func main() {
// ADD YOUR DECLARATION HERE
//
// REPLACE THE QUESTION-MARKS BELOW
// WITH THE NAME OF YOUR VARIABLES
// fmt.Printf("%q %q\n", ?, ?)
}

View File

@ -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
import "fmt"
func main() {
var firstName, lastName string = "", ""
fmt.Printf("%q %q\n", firstName, lastName)
}

View File

@ -0,0 +1,21 @@
// 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
// 1- Declare a variable
// 2- Variable's name should be: isLiquid
// 3- Discard it using a blank-identifier
//
// NOTE
// Do not print the variable
// ---------------------------------------------------------
func main() {
}

View File

@ -0,0 +1,13 @@
// 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() {
var isLiquid bool
_ = isLiquid
}

View File

@ -0,0 +1,19 @@
// 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
// 1- Declare a variable in the package-scope
//
// 2- Observe whether something happens when you don't
// use it
// ---------------------------------------------------------
func main() {
}

View File

@ -0,0 +1,13 @@
// 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
var isLiquid bool
func main() {
}

View File

@ -0,0 +1,24 @@
// 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
// 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 ? ?
}

View File

@ -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
}