Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 527

How to find the index of the first non-zero element in an array

$
0
0

I am trying to find the index of the first non-zero number in an array.

Consider an array: [0;0;1;2;0;4;5;6]

The expected result will be index of number 1 which should return the index result of 2.

It will be great if the answer avoids the use of sequence operator and loops.


Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>