File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
content/labs/intro-to-ada/chapters Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments