diff options
| author | Simon Proctor <simon.proctor@zoopla.co.uk> | 2021-02-01 13:11:25 +0000 |
|---|---|---|
| committer | Simon Proctor <simon.proctor@zoopla.co.uk> | 2021-02-01 13:11:25 +0000 |
| commit | 9d5b485fe19209fa05b3a70a607ecc589387a86e (patch) | |
| tree | da119e07d699c3e92451c2edaed75ab998587711 | |
| parent | d9b6efeea7a9664ac3d651fa651f772087ca6e9f (diff) | |
| download | perlweeklychallenge-club-9d5b485fe19209fa05b3a70a607ecc589387a86e.tar.gz perlweeklychallenge-club-9d5b485fe19209fa05b3a70a607ecc589387a86e.tar.bz2 perlweeklychallenge-club-9d5b485fe19209fa05b3a70a607ecc589387a86e.zip | |
Handle non integer characters. Catching the Failure
| -rw-r--r-- | challenge-098/simon-proctor/raku/ch-1.raku | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/challenge-098/simon-proctor/raku/ch-1.raku b/challenge-098/simon-proctor/raku/ch-1.raku index e015d35687..098a789083 100644 --- a/challenge-098/simon-proctor/raku/ch-1.raku +++ b/challenge-098/simon-proctor/raku/ch-1.raku @@ -22,7 +22,7 @@ say "Self referential code is fun right?"; # While we have a truthy input while ( my $val = prompt( "How many characters should I print? " ) ) { my $rval = $val.Int(); - if ( $rval ~~ $val ) { + if ( $rval && $rval ~~ $val ) { if ( $rval < 0 ) { if ( $handle.tell() >= $rval.abs ) { $handle.seek($rval, SeekFromCurrent ); |
