This video covers the concept of type interfence in Scala by exploring the Scala dataype hierarchy and then using the Scala IDE to test your some examples of using type inference for variables and functions
- [Narrator] A really nice feature of Scala,…that helps reduce the amount of coding,…is called type inference.…Type inference is the process that the compiler uses…to determine the type of a value, a variable,…the return value of a function, based on the statement…in which it's found.…In Scala, variables can be declared without data types…if they contain an initialization value.…Before we look at some code examples on type inference,…let's take a close look at the hierarchy of all…the Scala data types.…
Here's a diagram of the Scala data types.…Notice that all the data types point up to…the very top level of Any.…Now, Any has two branches.…On the left hand side is AnyVal, and that has values…such as double, float, int, short, and byte,…are numeric values, as well as unit, boolean,…and character, or char.…On the right hand side, AnyRef, which is all…our reference variables, has object, sequences,…list, and string.…
So what happens is, in Scala, in order to infer…the data type, if you look down the left hand side,…
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
Scala Essential Training for Data Sciencewith Dan Sullivan1h 51m 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?
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.