mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-01-17 05:28:37 +01:00
[Perl6/en]Modify an error about the Range constructor (#3612)
[Perl6/en] Modify an error about the Range constructor
This commit is contained in:
parent
88223544ce
commit
f0f161981f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user