How to find index of max array value?

I need to find the index of the greatest value. I've tried printing the index by putting a sentence inside the if statement, and I've also tried by storing i into another variable. None of them worked.