diff options
author | Amans Tofu <kwl01skz@gmail.com> | 2019-08-30 17:22:27 +0800 |
---|---|---|
committer | Divay Prakash <divayprakash@users.noreply.github.com> | 2019-08-30 14:52:27 +0530 |
commit | f0f161981f2e3d35967878b6a7a2c71de75b2b64 (patch) | |
tree | cc8ffbb18b709c77b0a2274699e8ad087f8e692d /perl6.html.markdown | |
parent | 88223544ce093ee3409122e670418c6057c57b18 (diff) |
[Perl6/en]Modify an error about the Range constructor (#3612)
[Perl6/en] Modify an error about the Range constructor
Diffstat (limited to 'perl6.html.markdown')
-rw-r--r-- | perl6.html.markdown | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/perl6.html.markdown b/perl6.html.markdown index 1304869b..c7fde218 100644 --- a/perl6.html.markdown +++ b/perl6.html.markdown @@ -499,10 +499,19 @@ say False ~~ True; #=> True ## Range constructor ##------------------ -3 .. 7; # 3 to 7, both included +3 .. 7; # 3 to 7, both included. 3 ..^ 7; # 3 to 7, exclude right endpoint. -3 ^.. 7; # 3 to 7, exclude left endpoint. Same as `4..7`. -3 ^..^ 7; # 3 to 7, exclude both endpoints. Same as `4..6`. +3 ^.. 7; # 3 to 7, exclude left endpoint. +3 ^..^ 7; # 3 to 7, exclude both endpoints. + # 3 ^.. 7 almost like 4 .. 7 when we only consider integers. + # But when we consider decimals : +3.5 ~~ 4 .. 7; # False +3.5 ~~ 3 ^.. 7; # True, This Range also contains decimals greater than 3. + # We describe it like this in some math books: 3.5 ∈ (3,7] + # If you don’t want to understand the concept of interval + # for the time being. At least we should know: +3 ^.. 7 ~~ 4 .. 7; # False + ## This also works as a shortcut for `0..^N`: ^10; # means 0..^10 |