gokursu/main.go

88 lines
1.8 KiB
Go
Raw Normal View History

2024-01-04 07:30:51 +00:00
package main
import (
"fmt"
2024-01-10 14:05:43 +00:00
"golesson/arrays"
2024-01-22 01:12:30 +00:00
"golesson/channels"
2024-01-04 07:30:51 +00:00
"golesson/conditionals"
"golesson/defer_statement"
"golesson/examplerange"
2024-01-13 21:12:27 +00:00
"golesson/functions"
2024-01-21 16:01:48 +00:00
"golesson/goroutines"
2024-01-22 06:03:58 +00:00
"golesson/interfaces"
2024-01-04 07:30:51 +00:00
"golesson/loops"
2024-01-15 23:25:45 +00:00
"golesson/maps"
2024-01-20 08:11:46 +00:00
"golesson/pointers"
2024-01-10 14:05:43 +00:00
"golesson/slices"
2024-01-20 11:42:21 +00:00
"golesson/structs"
2024-01-04 07:30:51 +00:00
"golesson/variables"
2024-01-21 16:18:44 +00:00
"time"
2024-01-04 07:30:51 +00:00
)
func main() {
variables.Demo1()
fmt.Print()
conditionals.Demo3()
2024-01-04 15:32:09 +00:00
loops.Demo5()
2024-01-10 08:23:21 +00:00
arrays.Demo4()
2024-01-11 08:36:53 +00:00
slices.Demo2()
functions.SayHello("Mert Gör")
2024-01-15 23:25:45 +00:00
functions.Addition(2, 6)
var total = functions.Addition(3, 8)
2024-01-13 21:26:50 +00:00
fmt.Println(total)
2024-01-13 21:30:12 +00:00
fmt.Println(total * 10)
2024-01-15 23:25:45 +00:00
result1, result2, result3, result4 := functions.MathOps(10, 2)
2024-01-14 10:18:27 +00:00
fmt.Println("Add :", result1)
fmt.Println("Subtract :", result2)
fmt.Println("Multiply : ", result3)
fmt.Println("Divide : ", result4)
2024-01-15 23:25:45 +00:00
var result = functions.AddVariadic(1, 3, 4, 5, 3)
2024-01-14 14:29:53 +00:00
fmt.Println(result)
2024-01-14 14:31:00 +00:00
2024-01-15 23:25:45 +00:00
fmt.Println(functions.AddVariadic(1, 3, 4))
2024-01-14 14:34:18 +00:00
2024-01-15 23:25:45 +00:00
numbers_main := []int{1, 2, 3, 4}
2024-01-14 14:34:18 +00:00
fmt.Println(functions.AddVariadic(numbers_main...))
2024-01-15 23:25:45 +00:00
maps.Demo1()
examplerange.Demo1()
examplerange.Demo2()
2024-01-17 09:41:04 +00:00
examplerange.Demo3()
2024-01-20 08:11:46 +00:00
number := 20
2024-01-20 08:17:16 +00:00
pointers.Demo1(&number)
2024-01-20 08:11:46 +00:00
fmt.Println("Number in Main go file", number)
2024-01-20 08:17:16 +00:00
2024-01-20 08:24:46 +00:00
numbers:=[]int{1,2,3}
pointers.Demo2(numbers)
fmt.Println("Numbers in Main", numbers[0])
2024-01-20 11:42:21 +00:00
structs.Demo1()
structs.Demo2()
2024-01-21 16:01:48 +00:00
2024-01-21 16:18:44 +00:00
go goroutines.EvenNumber()
go goroutines.OddNumber()
time.Sleep(5 * time.Second)
fmt.Println("Main ended")
2024-01-22 01:12:30 +00:00
EvenNumberCn := make(chan int)
OddNumberCn := make(chan int)
go channels.EvenNumber(EvenNumberCn)
go channels.OddNumber(OddNumberCn)
EvenNumberTotal, OddNumberTotal := <- EvenNumberCn, <- OddNumberCn
multiply := EvenNumberTotal * OddNumberTotal
fmt.Println("Multiply Result : ", multiply)
2024-01-22 06:03:58 +00:00
interfaces.Demo1()
interfaces.Demo2()
defer_statement.B()
2024-01-25 13:00:13 +00:00
defer_statement.Test()
defer_statement.Demo3()
2024-01-04 07:30:51 +00:00
}