What do you need help with?
Get rid of val1 and val2 COMPLETELY.
Initialize the array with hardcoded values.
That way you won't be thinking that periods is somehow bound to the values in val1 and val2. It most certainly is not.
What do you need help with?
Get rid of val1 and val2 COMPLETELY.
Initialize the array with hardcoded values.
That way you won't be thinking that periods is somehow bound to the values in val1 and val2. It most certainly is not.