Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/quiz_brain.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'question.dart';

class QuizBrain {
int _questionNumber = 0;
int _maxQuestion = 0;

List<Question> _questionBank = [
Question('Some cats are actually allergic to humans', true),
Expand Down Expand Up @@ -48,13 +49,14 @@ class QuizBrain {
//TODO: Step 3 Part A - Create a method called isFinished() here that checks to see if we have reached the last question. It should return (have an output) true if we've reached the last question and it should return false if we're not there yet.

bool isFinished() {
if (_questionNumber >= _questionBank.length - 1) {
if (_maxQuestion >= _questionBank.length) {
//TODO: Step 3 Part B - Use a print statement to check that isFinished is returning true when you are indeed at the end of the quiz and when a restart should happen.

print('Now returning true');
return true;

} else {
_maxQuestion++;
return false;
}
}
Expand Down