You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your block now appears in the {span .mono}[Motion] palette with an input box: <!-- style="width:0.69792in;height:0.25in" / --> You can draw
112
+
Your block now appears in the {span .mono}`Motion` palette with an input box: <!-- style="width:0.69792in;height:0.25in" / --> You can draw
113
113
any size square by entering the length of its side in the box and
114
114
running the block as usual, by clicking it or by putting it in a script.
115
115
@@ -236,11 +236,11 @@ The window shows all of your
236
236
global custom blocks. You can uncheck some of the checkboxes to select
237
237
exactly which blocks you want to include in your library. (You can
238
238
"`right-click`" or "`control-click`" on the export window for a menu that lets
239
-
you check or uncheck all the boxes at once.) Then press "`OK`" An {span .mono}[XML] file
239
+
you check or uncheck all the boxes at once.) Then press "`OK`" An {span .mono}`XML` file
240
240
containing the blocks will appear in your Downloads location.
241
241
242
242
To import a block library, use the "`Import…`" command in the "`File`" menu,
243
-
or just drag the {span .mono}[XML] file into the Snap<em>!</em> window.
243
+
or just drag the {span .mono}`XML` file into the Snap<em>!</em> window.
244
244
245
245
Several block libraries are included with Snap<em>!</em>; for details about
Copy file name to clipboardExpand all lines: 05-typed-inputs.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,13 @@ data type
10
10
11
11
## Scratch’s Type Notation
12
12
13
-
Prior to version 3, Scratch block inputs came in two types: {span .mono}[Text-or-number] type and {span .mono}[Number] type. The former is
13
+
Prior to version 3, Scratch block inputs came in two types: {span .mono}`Text-or-number` type and {span .mono}`Number` type. The former is
14
14
indicated by a rectangular box, the latter by a rounded box: {inline alt="image654.png" class="image-inline"}`images/05-typed-inputs/image654.png`. A third
15
-
Scratch type, {span .mono}[Boolean] (true/false), can be used in certain {span .mono}[Control]
15
+
Scratch type, {span .mono}`Boolean` (true/false), can be used in certain {span .mono}`Control`
16
16
blocks with hexagonal slots.
17
17
18
-
The Snap<em>!</em> types are an expanded collection including {span .mono}[Procedure], {span .mono}[List],
19
-
and {span .mono}[Object] types. Note that, with the exception of {span .mono}[Procedure] types, all
18
+
The Snap<em>!</em> types are an expanded collection including {span .mono}`Procedure`, {span .mono}`List`,
19
+
and {span .mono}`Object` types. Note that, with the exception of {span .mono}`Procedure` types, all
20
20
of the input type shapes are just reminders to the user of what the
21
21
block expects; they are not enforced by the language.
contains the ones found in Scratch: {span .mono}[Number], {span .mono}[Any], and {span .mono}[Boolean]. (The
59
+
contains the ones found in Scratch: {span .mono}`Number`, {span .mono}`Any`, and {span .mono}`Boolean`. (The
60
60
reason these are in the second row rather than the first will become
61
61
clear when we look at the column arrangement.) The first row contains the
62
-
new Snap<em>!</em> types other than procedures: {span .mono}[Object], {span .mono}[Text], and {span .mono}[List]. The last two rows are the types related to procedures, discussed more fully below.
62
+
new Snap<em>!</em> types other than procedures: {span .mono}`Object`, {span .mono}`Text`, and {span .mono}`List`. The last two rows are the types related to procedures, discussed more fully below.
63
63
64
-
The {span .mono}[List] type is used for first class lists, discussed
64
+
The {span .mono}`List` type is used for first class lists, discussed
65
65
in Chapter IV. The red rectangles inside the input slot are meant
66
66
to resemble the appearance of lists as Snap<em>!</em> displays them on the
67
67
stage: each element in a red rectangle.
68
68
69
-
The {span .mono}[Object] type is for sprites, costumes, sounds,
69
+
The {span .mono}`Object` type is for sprites, costumes, sounds,
70
70
and similar data types.
71
71
72
-
The {span .mono}[Text] type is really just a variant form of the Any
72
+
The {span .mono}`Text` type is really just a variant form of the Any
73
73
type, using a shape that suggests a text input.[^5]
74
74
75
-
[^5]: In Scratch, every block that takes a {span .mono}[Text-type] input has a default
75
+
[^5]: In Scratch, every block that takes a {span .mono}`Text-type` input has a default
76
76
value that makes the rectangles for text wider than tall. The blocks
77
-
that aren’t specifically about text either are of {span .mono}[Number] type
77
+
that aren’t specifically about text either are of {span .mono}`Number` type
78
78
or have no default value, so those rectangles are
79
-
taller than wide. At first some of us (bh) thought that {span .mono}[Text] was a
79
+
taller than wide. At first some of us (bh) thought that {span .mono}`Text` was a
80
80
separate type that always had a wide input slot; it turns out that this
81
81
isn’t true in Scratch (delete the default text and the rectangle
82
82
narrows), but we thought it a good idea anyway, so we allow Text-shaped
83
-
boxes even for empty input slots. (This is why {span .mono}[Text] comes just above {span .mono}[Any]
83
+
boxes even for empty input slots. (This is why {span .mono}`Text` comes just above {span .mono}`Any`
84
84
in the input type selection box.)
85
85
86
86
:::{index} jigsaw-piece blocks
@@ -139,8 +139,8 @@ in an arbitrary input instead of using the pulldown menu.
139
139
140
140
Custom blocks can
141
141
also have such inputs. To make a pulldown input, open the long form
142
-
input dialog, choose a text type ({span .mono}[Any], {span .mono}[Text], or {span .mono}[Number]) and click the {inline alt="image658.png"}`images/05-typed-inputs/image658.png`<!-- style="width:0.13194in;height:0.13194in" -->
143
-
icon in the bottom right corner, or {span .mono}[control/right-click] in the dialog.
142
+
input dialog, choose a text type ({span .mono}`Any`, {span .mono}`Text`, or {span .mono}`Number`) and click the {inline alt="image658.png"}`images/05-typed-inputs/image658.png`<!-- style="width:0.13194in;height:0.13194in" -->
143
+
icon in the bottom right corner, or {span .mono}`control/right-click` in the dialog.
144
144
You will see this menu:
145
145
146
146
Click
@@ -211,7 +211,7 @@ type array.
211
211
212
212
The "`single input`" option: In Scratch, all inputs are in this category.
213
213
There is one input slot in the block as it appears in its palette. If a
214
-
single input is of type {span .mono}[Any], {span .mono}[Number], {span .mono}[Text], or {span .mono}[Boolean], then you can
214
+
single input is of type {span .mono}`Any`, {span .mono}`Number`, {span .mono}`Text`, or {span .mono}`Boolean`, then you can
215
215
specify a {index}`default value` that will be shown in that
216
216
slot in the palette, like the “10” in the <code>move (10) steps block</code>. In the
217
217
prototype block at the top of the script in the Block editor, an an input with
@@ -225,7 +225,7 @@ The "`Multiple inputs`" option:
225
225
The <code>list</code> block introduced earlier accepts any number of inputs to
226
226
specify the items of the new list. To allow this, Snap<em>!</em> introduces the
227
227
arrowhead notation (⏴⏵) that expands and contracts the block, adding and
228
-
removing input slots. ({span .mono}[Shift-clicking] on an arrowhead adds or removes
228
+
removing input slots. ({span .mono}`Shift-clicking` on an arrowhead adds or removes
229
229
three input slots at once.) Custom blocks made by the Snap<em>!</em> user have
230
230
that capability, too. If you choose the "`Multiple inputs`" button, then
231
231
arrowheads will appear after the input slot in the
0 commit comments