Cannot apply indexing with [] to an expression of type int

First off, please use code tags: Using code tags properly

Second, error messages have line numbers in them. That’s how you find the error. At the minimum, be so courteous when you post the above code and actually indicate which line that the error corresponds to in your posted code.

Spoiler: the line numbers are often different between what prints here in the forum, and what prints in your IDE, so a nice and easy…

// error happens in this next line!

… helps us all get on the same page.