arrays initial example
This commit is contained in:
parent
0f087948a0
commit
ff632efdf9
2 changed files with 12 additions and 0 deletions
10
arrays/arrays1.go
Normal file
10
arrays/arrays1.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package arrays
|
||||
|
||||
import "fmt"
|
||||
|
||||
func Demo1() {
|
||||
var numbers [5]int
|
||||
numbers[2]=50 // second index of the array
|
||||
fmt.Println(numbers)
|
||||
fmt.Println(numbers[2]) // will print second index of the array
|
||||
}
|
2
main.go
2
main.go
|
@ -5,6 +5,7 @@ import (
|
|||
"golesson/conditionals"
|
||||
"golesson/loops"
|
||||
"golesson/variables"
|
||||
"golesson/arrays"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -12,4 +13,5 @@ func main() {
|
|||
fmt.Print()
|
||||
conditionals.Demo3()
|
||||
loops.Demo5()
|
||||
arrays.Demo1()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue