Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 4.

Similar presentations


Presentation on theme: "Lesson 4."— Presentation transcript:

1 Lesson 4

2 Assessment tracking sheet
Bronze: Create a simple program that follows a clear set of instructions. (SA- self assessed) Silver: Use a text based programming language using sequence and selection. (Teacher Assessed in todays’ lesson) Declares and Assigns Variables. (PA- Peer Assessed) Gold: Annotates to demonstrate through understanding of code used (Teacher Assessed)

3 By the end of today’s lesson you will:
LO1: Be able to define what a IF statement is and what it can be used for. LO2: Be able to apply an IF statement to a program in Small Basic.

4 What is an IF statement? Bill Gates explains IF statements:

5 IF Else

6 Why? An IF statement lets you run a bit of code if you have met a rule
If you haven’t met a rule, another bit of code can be run. Another example could be: If it is raining then open the umbrella Else keep the umbrella closed You would only do one of these actions

7 If Statements Then – If we pass the test, what do we do next
If – This tells the computer we have a rule we want to test. Then – If we pass the test, what do we do next Else – If we fail the test, what should we do EndIf – Tells the computer, the If section is over

8 Using a program to determine if you passed or failed an exam.
TextWindow.WriteLine ("Enter your exam result to see if you passed") score = TextWindow.Read() If score >=55 Then TextWindow.WriteLine ("congratulations you got over 55, you passed the exam") Else TextWindow.WriteLine (" You got less than 55, unfortunately you didn’t pass") EndIf RAG cards Change the program so that the pass rate is 60 or higher

9 Operators Operator Meaning Example = Equal to If number = 5 then
<> Not equal to If number <> 8 then Less than If number < 4 then Greater than If number > 9 then <= Less than or equal to If number <=3 then >= Greater than or equal to If number >=7 then Operators

10 Plenary What is an IF statement?
Give an Example of an IF statement in everyday life terms. What are the key terms for an IF statement?


Download ppt "Lesson 4."

Similar presentations


Ads by Google