CMPT 166 Lecture Notes - Lecture 14: Concatenation, Escape Character, String Literal

30 views5 pages

Document Summary

In processing, a string is a sequence of 0 or more characters. More precisely, these are string literals because they begin and end with a " (double-quote). The string "" is known as the empty string: it is the string with 0 characters in it. Strings can contain escape characters in them, such as \n, , \, and \". When a newline is printed it makes the cursor go to the next line. We can also use assign strings to variables. The println function prints a string on the console; in the processing ide this is the small black window at the bottom of the editor window. Declaring a variable to be of type string ensures that processing only allows it to store strings. String s = "apple"; s = 55; // error: can"t assign a number to a string. Notice also that string begins with a capital s. if you wrote string instead you"d get an error.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions