File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
courses/fundamentals_of_ada/030_basic_types Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -253,19 +253,21 @@ Idiom: Subtypes as Local Constraints
253
253
254
254
Do not use for checks that should **always ** happen, even in production.
255
255
256
- .. code :: Ada
256
+ * Constrain input range
257
257
258
- subtype Incrementable_Integer is Integer
259
- range Integer'First .. Integer'Last - 1;
258
+ .. code :: Ada
260
259
260
+ subtype Incrementable_Integer is Integer range Integer'First .. Integer'Last - 1;
261
261
function Increment (I : Incrementable_Integer) return Integer;
262
262
263
+ * Constrain output range
264
+
263
265
.. code :: Ada
264
266
265
- subtype Valid_Fingers_T is Integer
266
- range 1 .. 5 ;
267
- Fingers : Valid_Fingers_T
268
- := Prompt_And_Get_Integer ("Give me the number of a finger");
267
+ subtype Valid_Fingers_T is Integer range 1 .. 5;
268
+ Fingers : Valid_Fingers_T := Prompt_And_Get_Integer ("Give me the number of a finger") ;
269
+
270
+ * Constrain array index
269
271
270
272
.. code :: Ada
271
273
You can’t perform that action at this time.
0 commit comments