Cannot apply indexing with [] to an expression of type 'int'
I am trying to convert an array string to an int array and try to access certain indexes
I can't access the index as I have tried on line 9
ty ^^
7 Replies
u mean line 8?
yes is an integer, u cant access it like its an array
yea
do i do int yes{} in time ?
what does {} represent in that context?
i mean []
but that doesn't seem to work
how do i access it like an array then
actually am i even doing it correctly xd
time
is already an array tho
what ur doing is iterating through each number of the arrayhmm
okay i'll keep that in mind
ig i fixed it by replacing yes[0] to time[0] instead
ty for the insight ^^
though i can't seem to go higher than 0 for some reason?
i think it's because all the "time" numbers are on index 0 instead of being distributed evenly throughout the array but that's another issue ig
When you're using a foreach loop, the loop will run for each element in the array,
time
in this case
You don't need to index time
when using a foreach loop, the loop itself will essentially do the indexing for you