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/conditionals"
|
||||||
"golesson/loops"
|
"golesson/loops"
|
||||||
"golesson/variables"
|
"golesson/variables"
|
||||||
|
"golesson/arrays"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -12,4 +13,5 @@ func main() {
|
||||||
fmt.Print()
|
fmt.Print()
|
||||||
conditionals.Demo3()
|
conditionals.Demo3()
|
||||||
loops.Demo5()
|
loops.Demo5()
|
||||||
|
arrays.Demo1()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue