Lecture 01 Course Introduction
Computer Science is no more about computers than astronomy is about telescopes.
- Introduction to Programing
- Managing Complexity: Mastering Abstraction; Programing Paradigms
This is a challenging course that will demand a lot from you.
But this will also be a fruitful course that will bring a lot to you.
-
Ask for help if you are stuck and make a good effort on all of the homework.
-
Do not share code.
Expressions
Description
An expression describes a computation and evaluates to a value.
Types of expressions
-
Primitive Expressions:
2
(numbers);"hello"
(strings);add
(names) -
Arithmetic Expressions:
1 + 2
;15 // 3
-
Call Expressions:
add(3, 4)
;max(add(2, 3), 5*min(-1, 4))
Evaluating call expressions
- Evaluate
- evaluate the operator subexpression
- evaluate each operand subexpression
- Apply
- apply the value of the operator subexpression to the values of the operand subexpression
Values
Description
-
Programs manipulate values
-
Values represent different types of data
Types of data
-
Integers:
2
;44
;-3
-
Strings:
"hello"
;"cs61a"
-
Floats:
3.14
;4.5
;-2.0
-
Booleans:
True
;False
Expressions evaluate to values in one or more steps