For example, I have an array data = 0 0 0 0 0 0 1 1 1
. I want to get the index of the first non-zero element in the array.
Get the index of the first element in an array that meets the specified condition
69 Views Asked by winnie At
2
For example, I have an array data = 0 0 0 0 0 0 1 1 1
. I want to get the index of the first non-zero element in the array.
Use the function
ifirstHit
. For example:Output: 6