The Artima Developer Community
Sponsored Link

Programming in Scala Forum
(0).to(2) vs 0.to(2)

1 reply on 1 page. Most recent reply: Nov 27, 2016 7:45 AM by Daniel Barclay

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Kyunam Kim

Posts: 1
Nickname: kyunam
Registered: Dec, 2014

(0).to(2) vs 0.to(2) Posted: Dec 27, 2014 9:05 AM
Reply to this message Reply
Advertisement
Hi,

Started a new year's (2015) resolution (digging into Scala) a bit early :-)

What is the difference between (0) & 0 in the followings:
for (i <- 0.to(2))
...
and
for (i <- (0).to(2))
...

Is (0) a Tuple1?

Thanks,
Q


Daniel Barclay

Posts: 5
Nickname: daniel7
Registered: Sep, 2016

Re: (0).to(2) vs 0.to(2) Posted: Nov 27, 2016 7:45 AM
Reply to this message Reply
> Hi,
>
> Started a new year's (2015) resolution (digging into
> Scala) a bit early :-)
>
> What is the difference between (0) & 0 in the followings:
> for (i <- 0.to(2))
> ...
> and
> for (i <- (0).to(2))
> ...
>
> Is (0) a Tuple1?


Isn't that "(0)" just a parenthesized expression whose inner expression is "0" (of type Int)?

Flat View: This topic has 1 reply on 1 page
Topic: Rational.gcd (Section 6.8, PDF page 144) Previous Topic   Next Topic Topic: Partially applied functions

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use