Join Kevin Skoglund for an in-depth discussion in this video Floats, part of Ruby Essential Training.
In the last movie we talked about the first type of number in Ruby, which is an integer.…In this movie we are going to talk about the second half, which are…floating-point numbers, or for short, we just simply call them floats.…Outside of programming you might simply call these decimal numbers or…numbers with precision. Let's take a look.…I am going to open up irb, and let's just try typing our first float, 12345.6789.…It has a decimal number.…This is a float, perfectly valid in Ruby.…If we hit the up arrow and then type class after it, you will see it comes back…and it tells us that it's a float.…
So this is what a float looks like.…Notice the difference between x=10, which returns 10 to me, and y=10.0, which…returns 10.0, and x's class is a Fixnum, while y's class is going to be a float.…So it lets it know by putting that .0 after it that it should put it as a…different kind of Ruby object.…It basically says, look, the precision here is important to me.…I care about the fact that it is exactly 10.0.…
- 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?
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.