Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. 2D Blocks
  4. Operators: plus minus multiply divide

Operators: plus minus multiply divide

Scheduled Pinned Locked Moved 2D Blocks
1 Posts 1 Posters 1.3k Views
  • 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.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

     

    Prerequisite

    • Working with Sprites

     

    Description

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

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/963e3572-2e6f-41ad-9d1f-81688ade8af6.PNG" width="600" style="">

    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.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/6d41b181-f2a2-4e7f-8202-2ce0d339eedd.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">
     

    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:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c9314b43-856d-447f-ab7f-b6a68edc65f0.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">

     

    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:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/09c7eed1-6e43-49f6-b357-8c2e108cb67c.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">
     

    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.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a266ec15-22e8-4156-851e-703251014110.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode