-
-
Save AlexDaniel/92f6f261cb6b4fbfced2c4a70b71c252 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test; | |
class F { | |
has Str $.txt is rw; | |
method Numeric { | |
$!txt.defined ?? $!txt.starts-with(0..9) ?? +$!txt !! $!txt.unival.Int !! Real; | |
} | |
}; | |
is(+F.new(txt=>"15"),15,"+15=15"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment