00:00
-02:07

RFS: Strings - 004

Strings are one of the most important data structure when it comes to the "web" we read, write, edit strings all day long on the web.

Basic String Manipulation

Let's try a couple of examples

name = "Zack"

We assign the string "Zack" to the variable name

Let's add strings

name + "Siri"=> "ZackSiri"

Let's try another example

name.chomp=> "Zac"

Notice that it didn't change the name variable if we want to modify the name varaible we have to do something like this.

name = name.chomp

This will assign the output of the method call to the name variable

Try out some examples from the ruby documentation!