How to get Array Length in Go? - Tutorial Kart
[Pages:2]How to get Array Length in Go?
Go ? Get Array Length
To get length of an array in Go, use builtin len() function. Call len() function and pass the array as argument. The function returns an integer representing the length of the array.
The syntax to call len() to find the length of an array arr is
len(arr)
Example
In the following program, we will create an array arr of specific size, and find its length programmatically using len() function.
example.go
package main import "fmt" func main() {
arr := [5]int{1, 2, 3, 4, 5} arrLength := len(arr) fmt.Println("Length of Array is :", arrLength) }
Output
Length of Array is : 5
Conclusion
In this Golang Tutorial, we learned how to find the length of an Array in Go programming, using len() function, with the help of example program.
Golang Golang Tutorial Run Golang Program Golang If Else Golang Switch Golang For Loop Golang Comments Golang Functions Golang Array Golang Slice Golang Struct Golang Class Golang Range Golang Map Golang Goroutine Golang Channel
Golang String Operations Golang String Length Golang String Concatenation Golang Split String Golang String - Get Index of Substr Golang String to Uppercase Golang String to Lowercase Golang Convert String to Integer
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- how to get your ged in florida
- how to get teaching certificate in georgia
- how to get started investing in stocks
- how to get teaching credentials in california
- how to get medical marijuana in ohio
- how to get a job in dubai
- how to get business license in nevada
- how to get steel ingots in ark
- how to get metal ingots in ark
- how to get a mod in minecraft
- how to get medical marijuana in florida
- how to get good grades in college