On Fri, Sep 28, 2018 at 2:57 PM ToddAndMargo <toddandma...@zoho.com> wrote:
> On 9/28/18 10:42 AM, Curt Tilmes wrote: > > Indeed we do, we have a special value just for that -- Inf or ∞. > > Inf or ∞ still means (to me) a number too large to represent. > But, I can't think of another way to say "all of them". > So if I was to ask you what limit I should use to make an iterator that created all of the numbers? I could set the limit at 2: 1..2 and you would get 2 numbers. I could set the limit at 1000: 1..1000 and you would get 1000 numbers. If you wanted all the numbers, where would you stop? What limit would you use? We use ∞ : Try this .say for 1..∞ It will give you all the numbers starting with 1 that Perl is capable of making (it may take a while...) Exactly the same for .words. You can say .words(2) and you get at most 2 words, the limit is 2. You can say .words(1000) and you get at most 1000 words, the limit is 1000. (Note you can get less that 1000 -- it isn't saying how many words, it isn't a count. It is a limit. it is setting the limit it won't go past.) If you don't want it to stop, you say .words(∞) or .words(Inf), or, since an infinite limit is the default, just .words() or .words. and it won't stop no matter how many it has already given you until it reaches the end. Curt