initial commit with BSD-3-Clause
This commit is contained in:
commit
1f888759ba
11 changed files with 254 additions and 0 deletions
28
LICENSE
Normal file
28
LICENSE
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Mert Gör and contributors
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
README.md
Normal file
34
README.md
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# Go Kursu
|
||||||
|
|
||||||
|
Go Programlama dili kursu. BTK AKADEMİ notlarından yararlanılmıştır. Go dili BSD 3 Clause lisanslı olduğundan otomatik olarak bu lisans atanmıştır.
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Mass Collaboration Labs and contributors
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
conditionals/demo1.go
Normal file
24
conditionals/demo1.go
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package conditionals
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func Demo1() {
|
||||||
|
var account float64 = 100
|
||||||
|
var money float64 = 10
|
||||||
|
|
||||||
|
var state bool
|
||||||
|
|
||||||
|
state = money > account
|
||||||
|
|
||||||
|
if state {
|
||||||
|
fmt.Print("not enough money ")
|
||||||
|
}
|
||||||
|
|
||||||
|
if money <= account {
|
||||||
|
fmt.Println("your money is getting ready")
|
||||||
|
account = account - money
|
||||||
|
fmt.Printf("account is : %v\n", account)
|
||||||
|
}
|
||||||
|
// fmt.Println("done. money in account : " + fmt.Sprintf("%v", account))
|
||||||
|
// fmt.Printf("done. money in account : %v", account)
|
||||||
|
}
|
25
conditionals/demo2.go
Normal file
25
conditionals/demo2.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package conditionals
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func Demo2() {
|
||||||
|
var account float64 = 1000
|
||||||
|
var money float64 = 11000
|
||||||
|
|
||||||
|
if money > account {
|
||||||
|
fmt.Println("not enough money")
|
||||||
|
} else if money == account {
|
||||||
|
fmt.Println("your money is getting ready")
|
||||||
|
fmt.Println("warning ! no money in account")
|
||||||
|
} else {
|
||||||
|
fmt.Println("your money is getting ready")
|
||||||
|
}
|
||||||
|
|
||||||
|
// if condition {
|
||||||
|
// if condition {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// // code
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
26
conditionals/workshop1.go
Normal file
26
conditionals/workshop1.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package conditionals
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func Demo3() {
|
||||||
|
// thre int variables defined
|
||||||
|
// print screen the max int
|
||||||
|
|
||||||
|
// var a int = 1
|
||||||
|
// var b int = 2
|
||||||
|
// var c int = 3
|
||||||
|
|
||||||
|
var number1, number2, number3 int = 10, 5, 18
|
||||||
|
|
||||||
|
var max int = number1
|
||||||
|
|
||||||
|
if number2 > max {
|
||||||
|
max = number2
|
||||||
|
}
|
||||||
|
|
||||||
|
if number3 > max {
|
||||||
|
max = number3
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("max number is: %v\n", max)
|
||||||
|
}
|
3
go.mod
Normal file
3
go.mod
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module golesson
|
||||||
|
|
||||||
|
go 1.21.5
|
21
loops/forloopdemo1.go
Normal file
21
loops/forloopdemo1.go
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package loops
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func Demo1() {
|
||||||
|
var text string = "Hello World !\n"
|
||||||
|
// fmt.Println(text)
|
||||||
|
// fmt.Println(text)
|
||||||
|
// fmt.Println(text)
|
||||||
|
// fmt.Println(text)
|
||||||
|
// fmt.Println(text)
|
||||||
|
|
||||||
|
i := 1
|
||||||
|
|
||||||
|
for i <= 10 {
|
||||||
|
fmt.Println(text)
|
||||||
|
i = i + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Done !")
|
||||||
|
}
|
10
loops/forloopdemo2.go
Normal file
10
loops/forloopdemo2.go
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package loops
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func Demo2() {
|
||||||
|
for i := 1; i <= 10; i++ {
|
||||||
|
fmt.Println(i)
|
||||||
|
}
|
||||||
|
fmt.Println("done\n")
|
||||||
|
}
|
20
loops/workshop1.go
Normal file
20
loops/workshop1.go
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package loops
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func Demo3() {
|
||||||
|
number_in_my_mind := 80
|
||||||
|
guess_number := 0
|
||||||
|
|
||||||
|
fmt.Println("Guess a number: ")
|
||||||
|
fmt.Scanln(&guess_number)
|
||||||
|
fmt.Println(guess_number)
|
||||||
|
|
||||||
|
if guess_number == number_in_my_mind {
|
||||||
|
fmt.Println("correct !")
|
||||||
|
} else if guess_number < number_in_my_mind {
|
||||||
|
fmt.Println("lower")
|
||||||
|
} else {
|
||||||
|
fmt.Println("bigger")
|
||||||
|
}
|
||||||
|
}
|
15
main.go
Normal file
15
main.go
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"golesson/conditionals"
|
||||||
|
"golesson/loops"
|
||||||
|
"golesson/variables"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
variables.Demo1()
|
||||||
|
fmt.Print()
|
||||||
|
conditionals.Demo3()
|
||||||
|
loops.Demo3()
|
||||||
|
}
|
48
variables/demo1.go
Normal file
48
variables/demo1.go
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
package variables
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func Demo1() {
|
||||||
|
/**
|
||||||
|
fmt.Print("Hello World !")
|
||||||
|
fmt.Print("Hello World !")
|
||||||
|
fmt.Print("Hello World !")
|
||||||
|
fmt.Print("Hello World !")
|
||||||
|
fmt.Print("Hello World !")**/
|
||||||
|
// fmt.Print("Dünya")
|
||||||
|
// fmt.Print("!")
|
||||||
|
var text string = "Hello World !"
|
||||||
|
fmt.Println(text)
|
||||||
|
fmt.Println(text)
|
||||||
|
fmt.Println(text)
|
||||||
|
fmt.Println(text)
|
||||||
|
fmt.Println(text)
|
||||||
|
fmt.Println(text)
|
||||||
|
|
||||||
|
var tax1 int = 15
|
||||||
|
|
||||||
|
fmt.Println(tax1)
|
||||||
|
fmt.Println(100 + (100 * 10 / 100))
|
||||||
|
fmt.Println()
|
||||||
|
|
||||||
|
var tax2 float32 = 0.1
|
||||||
|
|
||||||
|
fmt.Println(tax2)
|
||||||
|
fmt.Println(100 + 100*tax2)
|
||||||
|
|
||||||
|
tax3 := 25.2
|
||||||
|
//tax3 = "Engin"
|
||||||
|
fmt.Println(tax3)
|
||||||
|
fmt.Printf("data type: %T\n", tax3)
|
||||||
|
|
||||||
|
var statement bool
|
||||||
|
|
||||||
|
var text1 string = "Engin"
|
||||||
|
var text2 string = "Ahmet"
|
||||||
|
|
||||||
|
statement = text1 != text2
|
||||||
|
|
||||||
|
fmt.Println(statement)
|
||||||
|
|
||||||
|
fmt.Println(!statement)
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue