Getting a really weird error when trying to run a function that changes background color of a layer inside an array.
Works fine without the else statement, breaks when I add the else.
Anyone know how to go about debugging this? Really annoying because the error is thrown but code still works.
Could it be that days[i] doesn't exist for certain values of i that don't pass the if statement?
Ah, you probably meant to add another dot to 0...days.length. With two dots it's inclusive, while with three it stops one before so you don't go past the end of the array.
That fixed it! One dot means all the difference, so amazing. Thank you!!!
IndexErrors are the worst :-/
Happy to help :) As a side note, you could avoid the whole issue by doing something like this:
for day, i in days_if firstDateLoc < i and i <= d__day.backgroundColor="#22ADF6"_else__day.backgroundColor="white"
Handy syntax so you don't need to set the day variable to days[i] manually.