(Redirected from Arguments)

This article is about the part of a block. For a conflict between Scratchers, see Flame War.
"Insert" redirects here. For the Data block with "Insert" in its name, see Insert () at () of () (block). For a tutorial about how to insert a character into a string, see Inserting a Character into a String.

An argument is any area in a block that accepts user input, or another block. It can be a Boolean block, number input, Reporter block, string, or a drop-down menu.

Argument Types

The following are types of arguments in Scratch:

Numeric Input

A number input with the numpad active.

A numeric input is an input that accepts numbers, such as "10", "3.2", or "10e5" (in scientific notation). Numeric inputs also accept boolean blocks, converting true into the number 1 and converting false into the number 0. These inputs are rounded in shape to show their difference from other types of inserts. On touch screen devices, these inputs show a numpad when the input is active.

String Inputs

A string input is an input that accepts any text as input, including words, numerals, and sentences. String inputs also accept boolean blocks, converting true into the string "true" and converting false into the string "false". These inserts are also round.

Drop-Down Input

A drop-down menu.
([ v] of ( v))
The () of () block, which has
both types of drop-down input
Main article: Dropdown Menu

A drop-down input is an input that contains a string value that cannot be changed except by clicking the downwards arrow to the right. When the arrow is clicked, a menu of available options appears for the user to choose from. Clicking on an option changes the value of the dropdown menu.

There are two types of drop-down input. The first type of drop-down is rectangular and has the same color as the block it is in. Other blocks cannot be placed inside these inputs. Other drop-downs are round and have a darker color. This is caused by a limitation in the Blockly engine which blocks run on. Other blocks can be placed inside these inputs.

Boolean Input

A Boolean input is an input that accepts only Boolean blocks. Blocks that accept Boolean inputs (such as If () Then (block)) will do conditional actions based on the value reported. These inputs are in the shape of elongated hexagons, to correspond with the shape of boolean blocks. If left empty, the value of a Boolean input is always false.

Color Input

A color input is an input that allows the user to select a color. The input is round in shape, and when clicked, a small menu appears below the input, containing three sliders and an icon. The sliders can be modified to change the color, saturation, and brightness values of the color. When clicking on the color selection icon, the mouse changes into the "eyedropper" pointer and remains that way until the user clicks again. The color in the input will correspond with the color that the mouse was touching on the Stage when clicked. A reporter block can be dropped into a color input; in this case the value of the reporter should be a number representing the color in ARGB format. See Computer Colors.

Scratch Internals

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.

Types

In Scratch 1.4 and before, each argument had a Squeak code. These were all available in the Scratch-Blocks category in the System Browser. The following are the types of arguments with their Squeak code:

  • AttributeArgMorph — The first drop-down in the () of () sensing block
  • BooleanArgMorph — To insert a Boolean block
  • ChoiceArgMorph — A drop-down menu that does not allow reporter blocks to be dropped in
  • ChoiceOrExpressionArgMorph — A drop-down menu that allows reporter blocks to be dropped in
  • ColorArgMorph — A color argument
  • EventTitleMorph — A broadcast
  • ExpressionArgMorph — Either a number or string argument
  • ExpressionArgMorphWithMenu — Either a number or string argument that has a dropdown menu; differs from ChoiceOrExpressionArgMorph in the fact that it can have something typed in
  • SpriteArgMorph — A sprite drop-down menu

The other classes in Scratch-Blocks are block types.

Use in block specs (Scratch 1.4)

See also: Squeak Tutorial#Block arguments
The Replace Item () of () With () block with its arguments and variables highlighted.

Argument names are case-sensitive, and each is a letter. In a block spec, they are preceded by a percent sign to distinguish them from the block label.

Use in block specs (Scratch 2.0)

See Also

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