Skip to content

Commit ea67f46

Browse files
committed
Improve description of lab exercise
1 parent 69accc9 commit ea67f46

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

content/labs/intro-to-ada/chapters/subprograms.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,11 +497,24 @@ States #4
497497
#. Procedure :ada:`Set_Next` updates the machine's state with the next one
498498
in a *circular* manner:
499499

500-
- In most cases, the next state of :ada:`N` is simply the next number
501-
(:ada:`N + 1`).
500+
- In general, after a call to :ada:`Set_Next` for an integer variable
501+
:ada:`N` (:ada:`Set_Next (N)`), the new value of :ada:`N` must be
502+
the next number for that variable :ada:`N` (i.e.,
503+
:ada:`N := N'Old + 1`).
504+
505+
- In other words, a call to :ada:`Set_Next (N)` has the same effect
506+
as :ada:`N := N + 1`.
507+
508+
- For example, after the statements :ada:`N := 1; Set_Next (N);`,
509+
we have that :ada:`N = 2`.
510+
511+
- However, if the state is the last valid one for the machine (which,
512+
for this exercise, it's 2), the next state must be the first valid
513+
one (in this case: 0).
514+
515+
- In other words, for :ada:`N := 2; Set_Next (N);`, we have that
516+
:ada:`N = 0`.
502517

503-
- However, if the state is the last one (which is 2 for our machine),
504-
the next state must be the first one (in our case: 0).
505518

506519
**Remarks**:
507520

0 commit comments

Comments
 (0)