From f0f161981f2e3d35967878b6a7a2c71de75b2b64 Mon Sep 17 00:00:00 2001 From: Amans Tofu Date: Fri, 30 Aug 2019 17:22:27 +0800 Subject: [Perl6/en]Modify an error about the Range constructor (#3612) [Perl6/en] Modify an error about the Range constructor --- perl6.html.markdown | 15 ++++++++++++--- 1 file 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 -- cgit v1.2.3