This video presents a challenge to create a new worksheet in the Scala IDE. Next, add two functions to the worksheet, add and subtract. Finally, test these functions.
(whooshing)…- [Instructor] Are you ready to try some Scala programming?…This is the first challenge in our Scala activities.…In this challenge, I want you to create a new project…in your Scala IDE, then add a worksheet to this project.…In the worksheet, add two functions, call one add…and call the other one subtract.…Each function will take two arguments…and each one shall return one value.…Add will return the sum of two numbers…and subtract will return the difference of two numbers.…
Remember, when you're coding you won't actually see…anything happen until you save the worksheet.…So, save the worksheet and then make sure you test it out…by adding some statements that call your new functions.…So, add, the statements add with the values 10, 20…and call the subtract function, give that the values 10, 20.…Try adding some of your own test cases too,…maybe add 10 and 10 and subtract 10 minus 10…to see if you get zero.…I estimate that this challenge…will take you about 10 minutes.…
When you're done, come back and watch the solution video…
Join Peggy Fisher as she helps get you started with Scala, so you can leverage the unique capabilities it offers. First, learn the basics of type inference, variables, loops, functions, and operators. Then, find out how to read files using a console, perform pattern matching, handle exceptions, and more. Finally, learn how to use classes, fields, methods, and objects.
- Integrating with IDEs
- Scala worksheets
- Scala repl sessions
- Type inference
- Creating variables
- Working with loops
- Higher-order functions
- Scala operators
- Working with decision statements
- Handling exceptions using try or catch
- Working with tuples and arrays
- Classes, fields, and methods
Skill Level Intermediate
Java Platforms Compared: SE vs EE vs MEwith Peggy Fisher25m 38s Intermediate
1. Getting Started with Scala
2. Scala Basics
3. More Scala Basics
5. Objects with Scala
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.