• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with code....

 
Pankaj Mittal
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys !!

I've got one strange problem....I'm using netbeans 6.5.1 with scala plugin....dunno what the prob is...but sometime this code runs sometime doesn't...



Thanks !!
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is mosy likely here:



If you use the equals sign, you have to annotate the return type explicitly as Unit



Alternatively you could omit both the equals sign and the type annotation



Personally I prefer the first form over the second, because I think all top level methods should have their type explicitly annotated. But really it's a matter of preference.
 
Pankaj Mittal
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks....got it !!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic