Join Kevin Skoglund for an in-depth discussion in this video Conditionals: unless, case, part of Ruby Essential Training.
We have gone over all the basics that you will need in order to work with…Conditionals, if, else and else if will do everything that you need.…However, there are a couple of convenience conditionals that we can also use…that work kind of like a shorthand.…We are going to look at four of them.…There is unless, case, the ternary operator and or/or-equals.…So let's start out by looking at unless.…It looks like this, exactly like the if statement, but instead of if it's unless.…So unless a Boolean is true, which means the same as if not true, it's the reverse.…
So instead of being if not x > 3, it's unless x > 3.…So unless it's true, do this block of code.…Now unless can sometimes tie you in logical knots trying to work through exactly…when it's going to be used.…So only use it if it makes a lot of sense.…If it feels right and it's convenient use unless, but don't let it drive you crazy.…You can always just switch back to if and then the exclamation point for not and…it's the same thing.…Now you can use else and elseif still with unless, but there is no such thing as unlessif.…
- 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
Q: You mention e-texteditor.com as a place to get a Windows "sister" version of TextMate. However, e-texteditor.com looks like a Chinese auto website. Are there any other alternatives?
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?
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.