package main
import "fmt"
func main() {
var helloWorld string
helloWorld = "Hello World!"
fmt.Println(helloWorld)
}
Hello World!
package main
import "fmt"
func main() {
var hello, world string
hello = "Hello"
world = "World"
fmt.Println(hello, world)
}
Hello World
package main
import "fmt"
func main() {
var num1 int
fmt.Println("num1:", num1)
num1 = 10
fmt.Println("num1:", num1)
var num2 = 20
fmt.Println("num2:", num2)
}
num1: 0
num1: 10
num2: 20
package main
import "fmt"
func main() {
var num1, num2 = 10, 20
fmt.Println("num1: num2:", num1, num2)
num1, num2 = 30, 40
fmt.Println("num1: num2:", num1, num2)
}
num1: num2: 10 20
num1: num2: 30 40
package main
import "fmt"
func main() {
helloWorld := "Hello World!"
fmt.Println(helloWorld)
}
Hello World!
package main
import "fmt"
func main() {
hello, world := "Hello", "World!"
fmt.Println(hello,world)
}
Hello World!
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。