• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

C. Programming Concepts > Assignment and Operators

Assignment and Operators

You can put a value into a variable by using an assignment statement, which starts with a variable name, an equal sign, and the value. Examples:

currentWidth = 32;
message = "I love SVG.";

You can read these as “set the value of currentWidth equal to 32" and “set the value of message equal to "I love SVG." In reality, this statement works from right to left; whatever is on the righthand side of the equal sign is placed into the variable on the lefthand side. Note that all our ECMA Script statements end with a semicolon. There are cases where you don’t need one, but we’d rather have the semicolon and not need it than need it and not have it. Figure C-2 shows the “after” picture for these assignments.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint