Beautiful work, we can display one question at the time, we start with the first question, and I
think we're going to start somewhat simply by implementing the functionality where we can take a look
at the next question, because that is something that we have done quite a few times throughout our
project where I have the array.
And of course, now I would want to increase the state value of it by one every time I click on the
question.
And then once I get to the end of the questions, then of course we need to do something.
And in this case, it's not going to be going back to the beginning of the question.
Instead, we show the model and we're going to do that by setting up the function.
So at the moment, still above the use, the fact let's go with function and I'll call this next and
question its function is not going to be looking for any kind of arguments.
So the parameters will be empty.
Instead, inside of this function, we're going to go with set index and we'll use the functional approach
where we will pass in the function.
Remember, in the function, we can access the current or the old index.
However you would want to call it.
And then whatever we return from this function, of course, is going to be that new index in here and
construct a new one.
And that one is equal to old index and nine plus one since, of course, the next question is going
to have one index value more than the previous one.
And then as far as the return would just go with index.
Now, don't worry, because there's still functionality that is missing out here.
Let's just start with the basics.
So we have the next question.
Of course, I do need to pass the Senate.
So we're going to go with the next question.
I'm not in the up.
We structure it, we say next question, and we scroll down on where we have the button for the next
question, of course, let's go with Unclick and then let's pass.
And the next question, function and everything should work, but of course, we will run out of the
indexers.
So eventually we will run out of the questions.
So let's start clicking this.
Next one.
I'm not going to be clicking on the buttons, on the answering buttons because it doesn't really make
sense.
We don't have the functionality, the check that and eventually notice.
Cannot the structure properly.
Question of question index as it is on the phone.
So in the app, just remember, I have the set value of index and of course I'm looking for that particular
question, whether that is first one, second one or whatever.
And in the context, of course, I'm watching for how many questions?
Well, that is done.
Correct, because the amount is then.
So now here where I'm checking for the next question, at some point, once I get to the end of the
questions, of course, I would need to do something otherwise I'll always have this error and that
something is going to be followed where we're going to say if index is bigger than questions that length
and then remember minus one.
So that is going to let me know whether it is bigger than the last index in the array.
Then I would want to open up the model and I'm going to place this right now in the comment because
of course we don't have that functionality yet, but I'm just showing what we're going to do.
And as far as the return, well, we'll return a zero.
So don't worry.
Of course, at the moment we will go back to the first question, but eventually that open model is
going to go back to the form and all that.
So, yes, for the time being, it comes out that will go to the end of the array and then come back.
But we'll fix that once we set up the model.
So don't stress about it.
And then also I'll go with elsewhere.
If that is not the case.
If the index is not bigger than the last index in the area, then simply return that index.
So in this case, like I said, we're going to go to the anniversary and eventually we'll start back
from the scratch.
So that should be the basic setup where, of course, we can display all our questions.
And at the moment we're just iterating through the array.
We start with zero or all the way to nine because we have ten questions and then we circle back to the
start.