Join Kevin Skoglund for an in-depth discussion in this video Symbols, part of Ruby Essential Training.
In this movie we are going to talk about the Ruby data type for symbols.…And symbols are one of the most misunderstood types by most beginning Ruby programmers.…So I want to make sure that we have an understanding of it.…On one hand symbols are going to seem a lot like strings, but they are not.…And sometimes they are going to seem a lot like variables, but they are not.…What asymbol is, is a label that's going to be used to identify a piece of data.…Now a string can also be a label too.…We just saw that when we were working with hashes, right?…So, why do we need symbols?…Well the reason is because a symbol is going to be stored in memory one time.…
Whereas a string is going to get stored each time. Let's take a look.…I am going to open up a irb session.…And the way that we type a symbol is that we simply use the colon and than the name.…And the name works the same way the variable names would.…So we can have for example test.…That is a symbol, or this_test.…So, that's a symbol that we have just declared.…
- Using Ruby in the Interactive Ruby Shell and in standalone scripts
- Learning to write custom code blocks to find, merge, and sort
- Using modules for namespacing or as mix-ins
- Reading from and writing to files
- Creating a full Ruby project from start to finish
Skill Level Beginner
1. Getting Started with Ruby
2. Ruby Object Types
3. Control Structures
4. Code Blocks
8. Working with Files
9. Ruby Project: Creating the Food Finder
- 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.