FANDOM



If () then
2.0 If () Then

Category

Control Blocks

Type

C blocks

The If () Then block is a Control block and a C block. The block will check its boolean condition. If the condition is true, the code held inside the block will run, and then the script involved will continue. If the condition is false, the code inside the block will be ignored and the script will move on (unlike in the If () Then, Else block). If the condition turns to false while the script inside the block is running, it will keep running until it has finished.

Before Scratch 2.0, this block was named If ().


In programming, one of the most important parts is "checking conditions". This block is the simplest way to do that. Therefore, the block is used practically everywhere. Some common uses:

  • Comparing values
  • Checking if input is given
  • Controlling objects

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.