The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Unable to run scala code on page 75 (e-book)

2 replies on 1 page. Most recent reply: Feb 9, 2015 9:51 AM by Akarsh V

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 2 replies on 1 page
Akarsh V

Posts: 3
Nickname: mqindia123
Registered: Feb, 2015

Unable to run scala code on page 75 (e-book) Posted: Feb 9, 2015 9:34 AM
Reply to this message Reply
Advertisement
When Im trying to run thr arg command program of page 75, it is showing that arg not defined. Because of this I'm not able to proceed first chapter. I"m a beginner please help me.
Code:
println ("Hello"+args (0)+"!")


George B

Posts: 24
Nickname: hmgeorge
Registered: Feb, 2008

Re: Unable to run scala code on page 75 (e-book) Posted: Feb 9, 2015 9:42 AM
Reply to this message Reply
It works fine for me. What command are you using to try and run it? You need to be sure to include a command line argument (example in the book uses "planet") - if you leave it off the program blows up.

Akarsh V

Posts: 3
Nickname: mqindia123
Registered: Feb, 2015

Re: Unable to run scala code on page 75 (e-book) Posted: Feb 9, 2015 9:51 AM
Reply to this message Reply
Thanks for your quick reply. See I first created a new file named hello.scala then typrd the first println statement that is ("Hello, world, from a script!).My interpreter showed the output.
Now I see $ scala hello.scala... (whats this?)

Can yu be specific how I should run command line arguments in scala script.

Btw, when I type println ("Hello" + args (0) + "!") and type for run its showing arg not defined. What is $ scala helloarg.scala planet? Is it command line, If yes how do I work on them? Where should I type them? I'm running scala on eclipse luna on mac.

Flat View: This topic has 2 replies on 1 page
Topic: What run configuration should I choose to run my scala progs on Eclipse Previous Topic   Next Topic Topic: In search of deeper understanding of higher-function

Sponsored Links



Google
  Web Artima.com   

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