1 00:00:00,420 --> 00:00:08,220 Beautiful work, we can display one question at the time, we start with the first question, and I 2 00:00:08,220 --> 00:00:14,310 think we're going to start somewhat simply by implementing the functionality where we can take a look 3 00:00:14,310 --> 00:00:20,520 at the next question, because that is something that we have done quite a few times throughout our 4 00:00:20,520 --> 00:00:22,740 project where I have the array. 5 00:00:23,100 --> 00:00:30,930 And of course, now I would want to increase the state value of it by one every time I click on the 6 00:00:30,930 --> 00:00:31,440 question. 7 00:00:31,780 --> 00:00:37,330 And then once I get to the end of the questions, then of course we need to do something. 8 00:00:37,680 --> 00:00:41,890 And in this case, it's not going to be going back to the beginning of the question. 9 00:00:42,420 --> 00:00:48,110 Instead, we show the model and we're going to do that by setting up the function. 10 00:00:48,360 --> 00:00:55,210 So at the moment, still above the use, the fact let's go with function and I'll call this next and 11 00:00:55,560 --> 00:00:59,540 question its function is not going to be looking for any kind of arguments. 12 00:00:59,970 --> 00:01:01,560 So the parameters will be empty. 13 00:01:01,770 --> 00:01:08,910 Instead, inside of this function, we're going to go with set index and we'll use the functional approach 14 00:01:09,300 --> 00:01:10,720 where we will pass in the function. 15 00:01:10,750 --> 00:01:15,300 Remember, in the function, we can access the current or the old index. 16 00:01:15,330 --> 00:01:17,370 However you would want to call it. 17 00:01:17,610 --> 00:01:22,830 And then whatever we return from this function, of course, is going to be that new index in here and 18 00:01:22,840 --> 00:01:24,030 construct a new one. 19 00:01:24,270 --> 00:01:31,380 And that one is equal to old index and nine plus one since, of course, the next question is going 20 00:01:31,380 --> 00:01:35,420 to have one index value more than the previous one. 21 00:01:35,760 --> 00:01:39,180 And then as far as the return would just go with index. 22 00:01:39,330 --> 00:01:43,740 Now, don't worry, because there's still functionality that is missing out here. 23 00:01:44,040 --> 00:01:45,890 Let's just start with the basics. 24 00:01:46,200 --> 00:01:47,580 So we have the next question. 25 00:01:47,580 --> 00:01:50,060 Of course, I do need to pass the Senate. 26 00:01:50,310 --> 00:01:51,780 So we're going to go with the next question. 27 00:01:52,080 --> 00:01:53,310 I'm not in the up. 28 00:01:54,340 --> 00:02:02,710 We structure it, we say next question, and we scroll down on where we have the button for the next 29 00:02:02,710 --> 00:02:06,640 question, of course, let's go with Unclick and then let's pass. 30 00:02:06,640 --> 00:02:13,630 And the next question, function and everything should work, but of course, we will run out of the 31 00:02:13,630 --> 00:02:14,260 indexers. 32 00:02:14,800 --> 00:02:17,130 So eventually we will run out of the questions. 33 00:02:17,530 --> 00:02:19,270 So let's start clicking this. 34 00:02:19,270 --> 00:02:19,810 Next one. 35 00:02:19,810 --> 00:02:20,440 Next one. 36 00:02:20,770 --> 00:02:21,330 Next one. 37 00:02:21,420 --> 00:02:25,660 I'm not going to be clicking on the buttons, on the answering buttons because it doesn't really make 38 00:02:25,660 --> 00:02:25,960 sense. 39 00:02:25,960 --> 00:02:29,440 We don't have the functionality, the check that and eventually notice. 40 00:02:30,130 --> 00:02:31,330 Cannot the structure properly. 41 00:02:31,330 --> 00:02:35,500 Question of question index as it is on the phone. 42 00:02:36,010 --> 00:02:44,560 So in the app, just remember, I have the set value of index and of course I'm looking for that particular 43 00:02:44,740 --> 00:02:48,790 question, whether that is first one, second one or whatever. 44 00:02:49,180 --> 00:02:52,860 And in the context, of course, I'm watching for how many questions? 45 00:02:53,380 --> 00:02:54,580 Well, that is done. 46 00:02:54,910 --> 00:02:57,380 Correct, because the amount is then. 47 00:02:57,850 --> 00:03:04,720 So now here where I'm checking for the next question, at some point, once I get to the end of the 48 00:03:04,720 --> 00:03:10,090 questions, of course, I would need to do something otherwise I'll always have this error and that 49 00:03:10,090 --> 00:03:17,980 something is going to be followed where we're going to say if index is bigger than questions that length 50 00:03:18,220 --> 00:03:19,590 and then remember minus one. 51 00:03:19,870 --> 00:03:24,670 So that is going to let me know whether it is bigger than the last index in the array. 52 00:03:25,060 --> 00:03:31,960 Then I would want to open up the model and I'm going to place this right now in the comment because 53 00:03:31,960 --> 00:03:35,550 of course we don't have that functionality yet, but I'm just showing what we're going to do. 54 00:03:35,890 --> 00:03:39,930 And as far as the return, well, we'll return a zero. 55 00:03:40,720 --> 00:03:41,500 So don't worry. 56 00:03:42,190 --> 00:03:49,030 Of course, at the moment we will go back to the first question, but eventually that open model is 57 00:03:49,030 --> 00:03:50,810 going to go back to the form and all that. 58 00:03:51,280 --> 00:03:55,900 So, yes, for the time being, it comes out that will go to the end of the array and then come back. 59 00:03:56,140 --> 00:03:58,840 But we'll fix that once we set up the model. 60 00:03:59,170 --> 00:04:00,310 So don't stress about it. 61 00:04:00,580 --> 00:04:02,830 And then also I'll go with elsewhere. 62 00:04:03,100 --> 00:04:04,270 If that is not the case. 63 00:04:04,690 --> 00:04:11,980 If the index is not bigger than the last index in the area, then simply return that index. 64 00:04:12,340 --> 00:04:18,910 So in this case, like I said, we're going to go to the anniversary and eventually we'll start back 65 00:04:18,910 --> 00:04:20,070 from the scratch. 66 00:04:20,350 --> 00:04:25,690 So that should be the basic setup where, of course, we can display all our questions. 67 00:04:25,930 --> 00:04:29,670 And at the moment we're just iterating through the array. 68 00:04:30,100 --> 00:04:36,310 We start with zero or all the way to nine because we have ten questions and then we circle back to the 69 00:04:36,310 --> 00:04:36,640 start.