init
This commit is contained in:
commit
02a0b20746
7
01-hello.go
Normal file
7
01-hello.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello World")
|
||||
}
|
7
02-numbers.go
Normal file
7
02-numbers.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("1 + 1 =", 1 + 1)
|
||||
}
|
9
03-strings.go
Normal file
9
03-strings.go
Normal file
@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println(len("Hello World"))
|
||||
fmt.Println("Hello World"[1])
|
||||
fmt.Println("Hello " + "World")
|
||||
}
|
11
04-booleans.go
Normal file
11
04-booleans.go
Normal file
@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println(true && true)
|
||||
fmt.Println(true && false)
|
||||
fmt.Println(true || true)
|
||||
fmt.Println(true || false)
|
||||
fmt.Println(!true)
|
||||
}
|
8
05-variable.go
Normal file
8
05-variable.go
Normal file
@ -0,0 +1,8 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var x string = "Hello World"
|
||||
fmt.Println(x)
|
||||
}
|
11
06-mutation.go
Normal file
11
06-mutation.go
Normal file
@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var x string
|
||||
x = "first"
|
||||
fmt.Println(x)
|
||||
x = "second"
|
||||
fmt.Println(x)
|
||||
}
|
8
07-literal.go
Normal file
8
07-literal.go
Normal file
@ -0,0 +1,8 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
x := "Hello World"
|
||||
fmt.Println(x)
|
||||
}
|
9
08-constant.go
Normal file
9
08-constant.go
Normal file
@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
const x string = "Hello World"
|
||||
|
||||
func main() {
|
||||
fmt.Println(x)
|
||||
}
|
11
09-input.go
Normal file
11
09-input.go
Normal file
@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Print("Enter a number: ")
|
||||
var input float64
|
||||
fmt.Scanf("%f", &input)
|
||||
output := input * 2
|
||||
fmt.Println(input, "* 2 =", output)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user