Join Kevin Skoglund for an in-depth discussion in this video Loops, part of Ruby Essential Training.
We continue our discussion of Ruby's control structures by taking a look at loops.…Now a loop does exactly what you think it would.…It loops through a bit of code over and over and over again until you tell it to stop.…And the way that we define a loop in Ruby is by simply having loop space and…then word do, then the code that we want to repeat will be on a new line after that…and then on a new line once that's done, we would have the word end.…Everything from do to end would called a code block and we are going to be…talking more about code blocks a little later on and going into depth with them,…because they're a really useful thing.…
This really the first time we've encountered them, so just make a mental note…this is our first code block.…Loop will take a code block and just loop through that block over and over and over again.…In fact, if we were to go to irb and just type in something that was a really…simple look like this, it would just keep looping and it's called an infinite loop, …
- 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?
A: E-texteditor.com appears to have gone out of business. On Windows, you should use Sublime (<a target="_blank" href="http://www.sublimetext.com/">http://www.sublimetext.com/</a>) or Notepad++ (<a target="_blank" href="http://notepad-plus-plus.org/">http://notepad-plus-plus.org/</a>) instead.
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.