I'm new to Ada. I'm trying to get the following code to work:
begin
Ada.Text_IO.Put_Line("Student ID Score");
Ada.Text_IO.Put_Line("===================");
readAnswers(pAnswers, 1);
loop
declare
counter : Integer := 0;
studentInput : String := Get_Line(Input);
studentScore : Integer;
begin
numOfTests := numOfTests + 1;
current_student.ID := GetID(studentInput);
Ada.Text_IO.Put(Ada.Strings.Unbounded.To_String(current_student.ID));
readAnswers(studentInput (6 .. studentInput'Last) ,0);
studentScore := scoreTest(current_student.student_answer, current_answer_key, number_of_questions);
Ada.Integer_Text_IO.Put(studentScore);
New_Line(1);
end;
end loop;
Ada.Text_IO.Put_Line("===================");
Ada.Text_IO.Put("Tests Graded = ");
Ada.Integer_Text_IO.Put(numOfTests);
end;
Unfortunately, GNAT tells me that all the code after the loop is unreachable. How can I get this program to execute the loop and the code after it?
You forget the exit condition :
loop
exit when condition;
end loop;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With