Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scratch Programming Lesson 4 Question asking and answering.

Similar presentations


Presentation on theme: "Scratch Programming Lesson 4 Question asking and answering."— Presentation transcript:

1 Scratch Programming Lesson 4 Question asking and answering

2 We are going to learn… How to ask a question and receiving answer First touch of variable – answer Creating variables How to use If….. Else loop…. Forever IF vs. If Broadcast

3 Question asking and receiving answer Input answer here The answer will be stored in the “answer” variable

4 Variable What is variable? A storage location of some value or words is a variable When we ask more than one question, the latest one will over-write the previous one More variables are needed for storage

5 Creating variables Click here to create a new variable This box will pop-out and name should be given to the variable Choose the target user of the variable

6 How to use variable To control whether the variable will be displayed on the stage Give a value to the variable Change the value of a variable by a certain number

7 Operators (Part I) Addition, Subtraction, Multiplication and Division Smaller than, equal to OR greater than String- a sequence of characters String functions, 1) Join two strings together 2) Select one letter from the string depending on the position of the letter 3) Return the length of the string

8 If… else If the operation in returns a TRUE value, the commands here will start to run. If the operation in returns a FALSE value, the commands inserted here will start to run.

9 Forever If vs. If Forever If ▫Non-stop to check the condition If ▫Just check the condition once

10 Forever If vs. If Once the green flag is pressed ▫Would play meow sound whenever the mouse point to the sprite Would play meow sound only when the mouse point at the time and the green flag is pressed at the same time

11 Broadcast Generate a message to the program Set an object ( actor / background) to response when a message is broadcast by others

12 How to use Broadcast The sprite gives a broadcast signal: change The stage changes to another background when receive the “change” signal

13 Task of the lesson Start a new program In this program, the sprite can help you calculate 3 questions The green flag will be the program starter Input: ▫Tell the user that you are going to help them in ▫Allow the user to input 2 numbers, one by one Output: ▫Return “Correct!” if you have the correct answer and change to another background with a background music ▫Return “Wrong!, the answer is ___” to return the correct answer to the user ▫The outputs will be displayed 2-3 seconds Save your program and upload as Program4_3_ _ _ in eclass


Download ppt "Scratch Programming Lesson 4 Question asking and answering."

Similar presentations


Ads by Google