In this lesson, our instructor talks about ruby data types. First, he discusses numbers, integer literals, and floating point literals. Then he talks about strings, string Rdoc, string literals, string operators, and substrings. Finally, he talks about string encoding, symbols, and symbols rdoc.
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.
As you see here, it says, "A String object holds and manipulates an arbitrary sequence of bytes--typically representing characters."0406
"String objects may be created using String::new or as literals."0416
"Because of aliasing issues, users of strings should be aware of the methods that modify the contents of a String object."0425
Typically, methods ending in this exclamation mark--or bang value--that means modify their receiver, "while those without the '!' return a new String."0431
"However, there are exceptions, such as String #  =."0442
Now this "!"--what it will do is modify the existing object, so when you have that "!" value, it is not going to create a new object.0450
Some interesting things here: new--this is our constructor to make a String object; try_convert--this, I believe, is only 1.9.3, but what this does is, if I put in a string in this value, if it allows it to convert that to String, it will be String, but if it doesn't allow it...like this regular expression object...it will just say, "This is nil. I'm not going to allow that in."0459
It's smart enough to say, "Hey, this total value is already being stored in this identifier, total, but it has a value of 350"--it's going to know that it is an integer value and make that a string so it can read it.0756
The scope--for example, it worked for globals, instance, class variables...depending on the scope you're on, you can use a dollar sign total...this instance, you can even put..."at" total, or class variable, 0785
It makes it very easy to show all your text, because you can preserve all the spaces and things that you put between it.1108
To start it off, notice, I use this "less than", "less than"1121
This token tells Ruby, "Hey, this is a heredoc; this is a comment here; I'm not going to worry about how I'm going to parse this out," because once I put this "less than", "less than" here, that is saying this is a string.1132
"So this string--I'm going to store it as a value until I see this here token again."1154