package main
func plus(a int, b int){
return a + b
}
func main(){
plus(2, 2)
}
package main
import "fmt"
func plus(a int, b int) int{
return a + b
}
func main(){
result := plus(2, 2)
fmt.Print(result)
}
package main
import "fmt"
func plus(a int, b int, name string) (int, string){
return a + b, name
}
func main(){
result, name := plus(2, 2, "nico")
fmt.Print(result, name)
}
package main
import "fmt"
func plus(a ...int) int{
var total int // total := 0도 가능
for _, item := range a {
total += item
}
return total
}
func main(){
result, name := plus(2, 3, 4, 5, 6, 7, 8, 9, 10)
fmt.Print(result, name)
}
package main
import "fmt"
func main(){
name := "Nicolas!!!! is my name"
for index, letter := range name{
fmt.Println(index, letter)
}
for _, letter := range name{
fmt.Println(string(letter))
}
for _, letter := range name{
fmt.Printf("%o",letter)
}
for _, letter := range name{
fmt.Printf("%b",letter)
}
}
강의 출처 : 노마드코더(https://nomadcoders.co)
[Nomad Coin] Tour of Go - #3.4 Slices and Arrays (0) | 2022.07.10 |
---|---|
[Nomad Coin] Tour of Go - #3.3 fmt (0) | 2022.07.10 |
[Nomad Coin] Tour of Go - #3.1 Variables in Go (0) | 2022.07.10 |
[Nomad Coin] Tour of Go - #3.0 Creating the Project (0) | 2022.07.10 |
[Nomad Coin] Introduction (0) | 2022.07.09 |
댓글 영역