File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
categories/cookbook/02numbers Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 8
8
9
9
You want to check if a string is a valid number.
10
10
11
- # Most of the time you will not need to do this. Rather then testing
12
- # for a scalar's numerical nature you can ensure that the variable
13
- # contains a number by setting its type. Assigning a number to
14
- # that variable will cause it to be coerced into an integer or a
15
- # number.
11
+ Most of the time you will not need to do this. Rather then testing for a
12
+ scalar's numerical nature you can ensure that the variable contains a number
13
+ by setting its type. Assigning a number to that variable will cause it to
14
+ be coerced into an integer or a number.
16
15
17
- # Ensure that a variable is used to store a real number.
16
+ Ensure that a variable is used to store a real number.
18
17
19
18
my Num $number;
20
19
21
- # Ensure that a variable is used to store an integer.
20
+ Ensure that a variable is used to store an integer.
22
21
23
22
my Int $integer;
24
23
25
- # Sometimes you need to validate a string from some source
26
- # corresponds to a real or an integer. In this situation compare
27
- # it against the rule for integers or reals.
24
+ Sometimes you need to validate a string from some source corresponds to a
25
+ real or an integer. In this situation compare it against the rule for
26
+ integers or reals.
28
27
29
28
= end pod
30
29
You can’t perform that action at this time.
0 commit comments