Download presentation
Presentation is loading. Please wait.
Published byBertina Manning Modified over 9 years ago
1
David Stotts Computer Science Department UNC Chapel Hill
2
0. data (types, simple information) 1. data storage (variables, assignment) 2. data retrieval (expressions, evaluation) 3. repetition (loops) 4. decision making (conditionals) 5. procedure abstraction (functions) 6. data abstraction (arrays) 7. objects: all-the-above, wrapped up
3
We can’t study data storage and retrieval without knowing what “data” is Data the basic symbols and information that a computer manipulates Data is why we write programs in the first place… we have questions, we want answers Want information we have (input) turned into new information we need (output)
4
Input information we have and want a program to work on… we have to get it from the user and make it available to the program, in the computer memory Output the new info we expect the program to produce, to generate, to compute… we have to get it out of the program and back to the user in a form the user can consume and employ I/O is the term we use
5
computer I/O Cloud, etc.
6
Number 4, 10, -23, 729358, -414, 0 3.14159, -21.15, 7.0, 1101.1 5.3e7 17.336e-14 0.000031 integers and reals
7
String “tarheels” “x” “3.14159” “(919) 555-1212” “xp @ aol.com” “hola ! !” “$ntko # &”
8
Boolean true, false (yes, no) are the only values the basis for “logic”
9
Number + - / * % 4+5 9 23.4 + 9.3 32.7 -2 * 7 -14 3.4 – 1.1 2.3 7/2 3.5 53 % 12 5 “mod”
10
Text + concat substring “abc” + “123” “abc123” we call this concatenation “abc”.concat(“123”) “abc123” “tarheels”.substring(3) “heels” “tarheels”.substring(0,2) “tar”
11
Boolean && || ! true && true true AND true && false false false && false false true || false true OR true || true true false || false false !false true NOT !true false
12
Comparisons 5 < 8 true less than 17 <= 3.28 false less than or equal 21.4 > -34 true greater than 1.0 >= 1.1 false greater than or equal 12.3 == 2.8 false equal to 12.3 === 2.8 false equal to (safe) -3 != -3.1 true not equal to -3 !== -3.1 true not equal to (safe)
13
Comparisons work on strings too “hello” < “world” true alpha order-ish “bigfoot” > “big” true “tar” == “tarheels” false “tar” < “tarheels” true (it’s shorter) “Upper” != “upper” true case matters “upper” > “Upper” true (seems strange) “5” > “4” true these are not numbers “5” > “40” true remember… alpha order
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.