Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Go: A question about "methods on types"

 
atul khot
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Mark,

Here goes ;-) a code snippet from gotour,



What is happening on line 18?

The syntax
-math.Sqrt2
is this the same as
-math.Sqrt(2)

The lack of parenthesis stumped me...
I understand the rest...

--- thanks atul
 
atul khot
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess math.Sqrt2 is some constant in the math package...

--- cheerio atul
 
Mark Summerfield
author
Ranch Hand
Posts: 37
Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Atul,

Yes you're right math.Sqrt2 is a predefined constant.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!