The general shape of a C block

A C block is a type of block that can wrap around other blocks. They are used to repeatedly or conditionally run blocks.

Shape

C blocks have a mouth in which blocks can be placed. All but one of the C blocks consist of one mouth; the other, the If () Then, Else block, consists of two mouths (for this reason, this block is occasionally referred to as an "E block"[1][2]). C blocks will automatically extend the height of their mouth to match the height of the blocks within its mouth.

repeat (10)
    repeat until <(loudness) > [30]>
        glide (1) secs to x: (10) y: (0)
        wait (1) seconds
        go to x: (0) y: (0)
    end
    play sound (meow v) until done
end

Most C blocks, like Stack Blocks, have a notch on the top and a bump on the bottom of the block, signifying that other blocks can be stacked above or below them. The forever block is an exception in that it does not have a bump on the bottom; for this reason, it is also classified as a Cap Block.

C Blocks in Scratch 3.0

There are five C blocks in Scratch 3.0, and they can all be found in the Control category.

Note Note: Click on a block for more information.

Removed C Blocks

Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.
forever if <> {
} :: control cap
The Forever If () block.

In Scratch 1.4 and earlier, there existed a forever if <>::control block. It can be recreated with the following script:

forever
    if <> then
    end
end

Uses

As C blocks are used to repeatedly or conditionally run blocks, they are essential for creating programs with non-linear paths. Some example use cases include:

  • Creating a scripts which runs forever
when gf clicked
forever
    turn cw (15) degrees
end
  • Checking a condition
when [space v] key pressed
if <(loudness) > [30]> then
    stop [all v]
end
  • Repeating an animation a certain number of times
when gf clicked
repeat (200)
    turn ccw (36) degrees
    change [color v] effect by (1)
end

References

Cookies help us deliver our services. By using our services, you agree to our use of cookies.