文档介绍:Programming in Scala Excerpt artima A RTIMAP RESS M OUNTAINV IEW, C ALIFORNIA Buy the Book·Discuss 2 Thank you for downloading this sample eBook chapter from the First Edition ofProgramming in Scala. The only difference between the actual eBook chapter and this sample is that in this document, the page numbers start at 1, and links outside the chapter show up as a double question marks. In the actual eBook, those question marks resolve to the real reference, which also serves as a hyperlink. The difference between this chapter and its appearance in the paper book is that the paper book uses shades of gray, not color, to syntax highlight code. We hope you ?nd this sample chapter useful and enjoyable. Bill Venners President, Artima, Inc. Copyright ?2007, 2008 Martin Odersky, Lex Spoon, and Bill Venners. All rights reserved. Buy the Book·Discuss Excerpt fromProgramming In Scala Chapter 2 First Steps in Scala It’s time to write some Scala code. Before we start on the in-depth Scala tutorial, we put in two chapters that will give you the big picture of Scala, and most importantly, get you writing code. We encourage you to actually try out all the code examples presented in this chapter and the next as you go. The best way to start learning Scala is to program in it. To run the examples in this chapter, you should have a standard Scala installation. To get one, go to /downloads and follow the directions for your platform. You can also use a Scala plug- in for Eclipse, IntelliJ, Beans, but for the steps in this chapter, we’ll assume you’re using the Scala distribution from scala-. 1 If you are a veteran programmer new to Scala, the next two chapters should give you enough understanding to enable you to start writing useful programs in Scala. If you are less experienced, some of the material may seem a bit mysterious to you. But don’t worry. To get you up to speed quickly, we had to leave out some details. Everything will be explained in a less “?re hose” fashion in late