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