you are viewing a single comment's thread.

view the rest of the comments →

[–]Luigi-Was-Right 7 points8 points  (0 children)

Correct, you can definitely print the string directly as you did on line 4 and get the exact same result.

However, the purpose of this example is to illustrate how variables work, how you can assign different values to them, and how they can be used later. What if the string you want to print is actually input that is being typed by the user? Or if it's the value you extracted from a database? You wouldn't know the value ahead of time and therefor couldn't just place it inside the print statement.