A specific type function in Scala is called a higher order function. This type of function either takes another function as a parameter or returns a function.
- [Instructor] In Scala,…we not only have regular functions,…we also have something called higher-order functions.…Remember, Scala is a functional programming language.…A higher-order function is a function that takes…another function as a parameter, or returns a function.…This is in contrast to a first-order function,…which takes only data items in as parameters.…I think they best way to explain this…is to look at some examples,…so let's switch over to the Scala IDE,…and I'm going to create a new Scala worksheet,…and I'm going to call it Order FNS, for functions.…
Higher-order functions.…So the first example that I want to do,…is where one function takes another function as input,…so let's start with that.…I'll start with the function that's going to…actually double any number that's passed into it.…So I'm going to give it a name,…I'm just going to call it double,…because it's going to double the value.…Is equal to and I'm going to take in an integer,…so I'll use i and then what happens is this function is…going to take i and it's going to multiply it by two,…
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
4. 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?
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.