File tree 2 files changed +89
-0
lines changed
2 files changed +89
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* package main
2
+
3
+ import (
4
+ "errors"
5
+ "fmt"
6
+ )
7
+
8
+ func main() {
9
+
10
+ result, err := evenNum(11)
11
+ if err != nil {
12
+ fmt.Println(err)
13
+ } else {
14
+ fmt.Println("Girdiğiniz sayı: ", result)
15
+ }
16
+
17
+ }
18
+
19
+ func evenNum(num int) (int, error) {
20
+ if num%2 != 0 {
21
+ return 0, errors.New("HATA: Çift sayı girmediniz")
22
+ }
23
+
24
+ return num, nil
25
+ } */
26
+
27
+ /* package main
28
+
29
+ import (
30
+ "errors"
31
+ "fmt"
32
+ "math"
33
+ )
34
+
35
+ func main() {
36
+
37
+ result, err := sRoot(-5)
38
+ if err != nil {
39
+ fmt.Println(err)
40
+ } else {
41
+ fmt.Println(result)
42
+ }
43
+ }
44
+
45
+ func sRoot(num float64) (float64, error) {
46
+ if num < 0 {
47
+ return 0, errors.New("Negatif sayıların karekökü alınamaz")
48
+ }
49
+
50
+ return math.Sqrt(num), nil
51
+ } */
52
+
53
+ /* package main
54
+
55
+ import (
56
+ "fmt"
57
+ "math"
58
+ )
59
+
60
+ func main() {
61
+
62
+ result := sRoot(-4)
63
+ {
64
+ fmt.Println(result)
65
+ }
66
+ }
67
+
68
+ func sRoot(num float64) float64 {
69
+
70
+ return math.Sqrt(num)
71
+ } */
72
+
73
+ package main
74
+
75
+ import (
76
+ "fmt"
77
+ "os"
78
+ )
79
+
80
+ func main () {
81
+
82
+ file , err := os .Open ("test.txt" )
83
+ if err != nil {
84
+ fmt .Println (err )
85
+ } else {
86
+ fmt .Println ("Dosyamız" , file )
87
+ }
88
+
89
+ }
You can’t perform that action at this time.
0 commit comments