Computer Science 1026A/B Lecture 2: CompSci-Chapter 2 Notes

203 views13 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

Variables: a variable is a named storage location in a computer program, there are many different types of variables, each type used to store different things. You define" a variable by telling the compiler: what name you will use to refer to it, the initial value of the variable. You use an assignment statement to place a value into a variable. *to define a variable, you must specify an initial value. Use the assignment statement "=" to place a new value into a variable cansperpack = 6 # define & initializes the variable cansperpack. Beware: the = sign is not used for comparison: It copies the value on the right side into the variable on the left side. You will learn about the comparison operator in the next chapter. The value on the right of the =" sign is assigned to the variable on the left.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents