In this lesson, we will be discussing operators commands with the help of Arun and Raj.
Arun- Let’s start with these commands which will be helpful for performing mathematical equations.
Raj- These are to be used as conditions in conditional statements.
Now start with block. This block joins the two statements.
Arun- Click on it.
Arun- Similarly, next is block. Click on it to see what it does.
Raj- This block tells us about the specific letter, according to our input.
Arun- Good. Next is block.
Raj- I can tell, this block gives the length of the character written.
Arun- You are right. Let’s move to the next block which is block.
Raj- What this block does?
Arun- It checks that the first parameter’s character contains the second parameter’s text in it or not.
Raj- This is a conditional statement.
Arun- Yes! Let’s apply these blocks with other conditional blocks such as , and blocks.
Raj- How Arun?
Arun- Drag out blocks and place them as shown.
Arun- As you can see, we are using block, which means the condition is true only when both the statements should be true otherwise false.
Raj- One of the statements is false that is why else condition is executed.
Arun- Correct! Similarly, you can replace block with block.
Raj- Now if any one statement will be true than whole condition also be true.
Arun- Now replace block with block and use block, select another sprite from the drop-down list.
Raj- Not means when this given condition is not true.
Arun- Correct! Click on green flag.
Raj- As the condition is true the sprite’s costume changed.
Arun- Yes! Now we will discuss about , and blocks.
Arun- Use block and place block as a comparing condition as shown. Click on green flag.
Raj- I am writing ‘Knowledge’ in the place of apple in block and changing value of block.
Arun- Length is same as the given value so the condition is true.
Raj- I got it Arun!
Arun- Similarly, you can useand blocks in place of block.
Raj- On clicking the green flag, in block, the condition is true so costume changes and in block, the condition is false so backdrop changes.
Arun- Correct! There are some basic mathematical operation blocks such as , , and blocks.
Raj- These blocks perform basic operations.
Arun- Can be used a condition in conditional commands such as
Raj- Here the condition will be true so costume of fish will get changed.
Raj- These operator blocks are very helpful to make the project. What is the next block?
Arun- Next block is block. This block picks any random value between the two given values.
Raj- Every time on clicking shows different value.
Arun- Now the next block is block, this block gives the remainder between the two given values.
Raj- It can take decimal value also.
Arun- Yes! Now move to next block which is block. This block will round off the values.
Raj- What block will do?
Arun- This last block performs various functions. Select from the drop-down list.
Raj- I am choosing square root function.
Arun- Okay! Write the value and click on it.
Arun- I hope you have understood purpose of each block. Next time we will discuss about how to create variable and new block.