[Csnd] how to detect the index

Dear community,
I would like to know, how I could detect the index of a special element in an array.
If this would be the array:
giTubMidNotnums[ ] fillarray 45, 52.28, 53.13, 56.6, 60.4, 67.68, 68.53, 72.0, 75.9, 83.18, 84.03, 87.5
how could I find the index for e.g. 60.4
Thanks for any hint!

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Look at bisect here:

Csound mailing list Send bugs reports to Discussions of bugs and features can be posted here

or you write a small udo which runs through the array and returns the index in case the element is being found:

opcode SearchEl, i, ii[]
  ;returns -1 if iEl is not in iArr, otherwise the index
  iEl, iArr[] xin
  iRes = -1
  indx = 0
  while indx < lenarray:i(iArr) do
   if iEl == iArr[indx] then
    iRes = indx
    igoto end
   indx += 1
  xout iRes

instr 1
  iArr[] fillarray 1,2,3,4,5
  iIndex SearchEl 3, iArr
  print iIndex


Thanks for Your help!
I think I will use the udo.