How do I initialize an array without using a for loop in Go?

前端 未结 2 1469
南旧
南旧 2021-01-05 12:43

I have an array A of boolean values, indexed by integers 0 to n, all initially set to true.

My current implementa

2条回答
  •  心在旅途
    2021-01-05 12:59

    Make initilization using range function without knowing the number of elements in the array.

    for i,_:=range(A){A[i] = true}
    

提交回复
热议问题