Join Kevin Skoglund for an in-depth discussion in this video Sort, part of Ruby Essential Training.
In this movie we are going to look at Ruby's Sort method which also makes use of a code block.…Now the code blocks we have been looking at before we've put Booleans in our…code block or we've put conditional statements that determined whether or not a…certain value should be returned, or we've returned a value as the result of…some sort of transformation or processing that we have done.…Well, the Sort, we are going to provide a comparison.…We haven't really talked about comparisons yet, so let's look for a moment at…the Comparison operator.…Now, I also call this the spaceship operator, because that's what it looks like,…a little flying saucer.…
So we have the less than sign, the equal than sign, and then the greater than sign, …and altogether that makes up the Comparison operator.…The way we use it is to compare two values.…Value one on one side, value two on the other.…When it compares those, the same way that a boolean compares two values and…returns true or false, Comparison operator is going to do more than just…
- 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.