Dont understand the Code


#1


#2

what does this modules operater do in this code


#3

Hint: for N > 0, m ≥ 0: if k = m % N, then 0 ≤ k < N.


#4

It’s a way to wrap around from the last question to the first question. The modulus operator gives you the remainder of a division, so if mQuestionBank.length is 6, you always end up with a value between 0 and 5 which can then be used as the index. So if mCurrentIndex gets to be larger, let’s say 25:
25 % 6 = 1
If you’re on the last question and you click Next, you just go back to the first question.

It saves on writing out logic to check the lower and upper bounds of the index.