Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Operators: plus minus multiply divide

    2D Blocks
    1
    1
    373
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • info-creaticode
      CreatiCode last edited by admin

       

      Prerequisite

      • Working with Sprites

       

      Description

      The Plus(+), Minus(-), Multiply(*) and Divide(/) blocks are Reporter Blocks in the Operators category.

      These blocks are used to Add, Subtract, Multiply and Divide two numbers. Since they are reporter blocks, the calculation results will be reported as the value of the block.


       

      Using Variables as Input

      You can also use “variables” as input in these blocks. After assigning a value to a variable, you can place the variable inside the operator’s input box:

       

      Saving the Result in a Variable

      You can store the result from the operation in a variable, then display that variable’s value in the stage window like this:


       

      Nested Operator Blocks

      You can also put an operator block inside the input box of another operator block to create “Nested Operators”. Note that the order of the nested operator blocks is important: For example, 1 + (3*2) and (1+3) * 2 will give different answers.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post