CMPT 100 Lecture Notes - Dial Tone, Problem Solving

46 views1 pages
Published on 2 Feb 2013
To define a conditional task in terms of the condition and the task.
Use if, if/else, nested if/else, chained if/else to define conditional tasks.
Relational expressions.
Boolean expressions.
Context is often determined by:
Each sub-task can be any kind of task.
Express the condition.
Describe the task.
To describe a conditional task.
How to recognize dial tone, etc
You may need to consider things that are not explicitly mentioned, e.g.,
Problem solving
Like a plan that is designed to handle several possibilities.
Only one context is true at any time.
When performing the task, you know which one is true.
You don't know which one is true!
You have to plan for both cases.
When designing the algorithm.
Conditional task
It's generally in the form of a statement that may come with a condition.
We can include any sub-task as part of an if statement
Indentation shows the extent of the subtasks in the then-clause.
The if statement.
The else part is optional.
The if-else statement is a special case of the if/else statement.
The if/else statement
Conditional Tasks
9:56 AM
CMPT 113.3 Page 1
Unlock document

This preview shows half of the first page of the document.
Unlock all 1 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.