Creating variables

To create a variable, you need to do two things:

  • Declare the variable
  • Assign a value (data) to the variable

As an example, let's make a variable, foo, and assign it the value bar. The code to do this would be:

foo = "bar"

That single line of code declares a variable and assigns a string value to the variable. If you break it into several parts, the actual line of code consists of the following pieces:

Why are there quote marks around bar? What is a string value? These questions will be answered in the coming two sections, Basic types and String types.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.176.72