Guj:બ્લોક્સ

બ્લોક્સ પઝલ-પીસ આકાર છે જેનો ઉપયોગ કોડ બનાવવા માટે થાય છે Scratch. બ્લોક્સ જીગ્સ p પઝલની જેમ એકબીજા સાથે જોડાય છે, જ્યાં પ્રત્યેક ડેટા પ્રકાર (ઇવેન્ટ, આદેશ, અહેવાલ કરેલ મૂલ્ય, અહેવાલ બુલિયન અથવા સ્ક્રિપ્ટ અંત) નો પોતાનો આકાર હોય છે અને તેમાં દાખલ થવા માટે વિશેષ આકારનો સ્લોટ હોય છે. આ સિન્ટેક્સ ભૂલોને રોકે છે. કનેક્ટેડ બ્લોક્સની શ્રેણી કહેવામાં આવે છે સ્ક્રિપ્ટો.

ત્યાં બ્લોકની બાર કેટેગરીઝ છે: ગતિ, લાગે છે, અવાજ, પેન, ચલો, સૂચિઓ, ઘટના, નિયંત્રણ, સંવેદના, સંચાલકો, પીકોબોર્ડ, અને LEGO WeDo (જોકે તેમાં કેટલીક અન્ય કેટેગરીઝ અને બ્લોક્સ છે સ્ક્રેચ ફેરફારો). દસમાં ફક્ત બતાવવામાં આવ્યું છે બ્લોક પેલેટ.

કુલ, ત્યાં અગિયાર ટોપી બ્લોક્સ, પાંચ સી બ્લોક્સ, સિત્તેર રિપોર્ટર બ્લોક્સ, તેર બુલિયન બ્લોક્સ, બે કેપ બ્લોક્સ અને સિત્તેર-સાત સ્ટેક બ્લોક્સ છે.

અવરોધિત આકારોs
છ જુદા જુદા બ્લોક આકારો છે: ટોપી, સ્ટેક, બુલિયન, રિપોર્ટર, સી અને કેપ.

ટોપી બ્લોક્સ


ટોપી બ્લોક્સ દરેક સ્ક્રિપ્ટ શરૂ કરે છે તે બ્લોક્સ છે. તેઓ ગોળાકાર ટોચ અને તળિયે બમ્પ સાથે આકારના હોય છે આ તે છે જેથી તમે ફક્ત તેમની નીચે બ્લોક્સ મૂકી શકો. ત્યાં 11 ટોપ બ્લોક્સ છે, જેમાંથી છ ઇવેન્ટ્સ કેટેગરીમાં છે, કંટ્રોલ કેટેગરીમાં એક છે, અને ચાર વધુ ટોપી બ્લોક્સ છે. ટોપી બ્લોક્સના કેટલાક ઉદાહરણો છે: when gf clicked, અથવા when this sprite clicked

સ્ટેક બ્લોક્સ


સ્ટેક બ્લોક્સ બ્લોક્સ છે જે મુખ્ય આદેશો કરે છે. તેઓ ટોચ પર એક ઉત્તમ અને તળિયે બમ્પ સાથે આકારના છે આ એટલા માટે છે કે બ્લોક્સ તેમને ઉપર અને નીચે મૂકી શકાય છે. ત્યાં 77 સ્ટેક બ્લોક્સ છે સૌથી સામાન્ય બ્લોક આકાર.

બુલિયન બ્લોક્સ


બુલિયન બ્લોક્સ શરતો છે તેઓ કાં તો સાચા કે ખોટા. તે તમારા મિત્રને પૂછવા જેવું છે: "શું 2 + 2 = 4?", અને તેઓ તમને "હા" અથવા "ના" કહેશે. ષટ્કોણ આકાર સાથે, આમાંના 13 અવરોધ છે.

રિપોર્ટર બ્લોક્સ


રિપોર્ટર બ્લોક્સ મૂલ્યો છે. રિપોર્ટર બ્લોક્સ નંબરો ધરાવે છે અને શબ્દમાળાઓ. તે મિત્રને પૂછવા જેવું છે, ઉદાહરણ તરીકે, "2 + 2 શું છે?", અને તેઓ "4" નો જવાબ આપશે. તે ફક્ત સમીકરણો જ નથી, તે રિપોર્ટ કરી શકે છે ચલો, ઉદાહરણ તરીકે, "તમારી ઉંમર શું છે?" તેઓ જવાબ આપી શકે છે: "15". ગોળાકાર ધાર સાથે આકારના, આમાંના 37 અવરોધ છે રિપોર્ટર બ્લોક્સની સૈદ્ધાંતિક અનંત માત્રાની ગણતરી કરવી નહીં કે જે દરેક ચલ અને સૂચિ માટે બનાવી શકાય છે.

સી બ્લોક્સ


સી બ્લોક્સ બ્લોક્સ છે જે "સી" નું આકાર લે છે. જેને "રેપ બ્લ "ક્સ" તરીકે પણ ઓળખવામાં આવે છે, આ બ્લોક્સ સીએસમાંના બ્લોક્સને લૂપ કરે છે અથવા કોઈ સ્થિતિ સાચી છે કે કેમ તે તપાસો. ત્યાં પાંચ સી બ્લોક્સ છે, અને તે નિયંત્રણ શ્રેણીમાં મળી શકે છે. સી બ્લોક્સ તળિયે ગબડાવી શકાય છે, અથવા appાંકી શકાય છે.

કેપ બ્લોક્સ


કેપ બ્લોક્સ તે બ્લોક્સ છે જે સ્ક્રિપ્ટોનો અંત લાવે છે. તેઓ ટોચ પર એક ઉત્તમ અને સપાટ તળિયે આકારના હોય છે આ તે છે જેથી તમે તેમની નીચે કોઈપણ બ્લોક્સ મૂકી શકતા નથી. ત્યાં બે કેપ બ્લોક્સ છે જે બંને નિયંત્રણ કેટેગરીમાં મળી શકે છે.

બ્લોક્સની સૂચિ
સ્ક્રેચ 2.0 માં 145 બ્લોક્સ છે.

ગતિ અવરોધ
ગતિ અવરોધ બ્લોક્સ કે જે નિયંત્રણ કરે છે સ્પ્રાઈટનો ચળવળ. સ્ક્રેચ 2.0 માં 17 મોશન બ્લોક્સ છે.

સ્ક્રેચ 2.0 માં નીચેના ચૌદ મોશન સ્ટેક બ્લોક્સ છે:


 * ખસેડો પગલાં  સ્પ્રાઈટ સામનો કરી રહી છે તે દિશામાં પગલાઓની માત્રાને આગળ સ્પ્રાઈટ ખસેડે છે.
 * Turn Degrees (Clockwise)  Turns the sprite (clockwise) the specified amount.
 * Turn Degrees (Counter-clockwise)  Turns the sprite (counter-clockwise) the specified amount.
 * Point in Direction  Points the sprite in the direction.
 * Point Towards  Points the sprite towards the mouse-pointer or another sprite.
 * Go to X: Y:   Moves the sprite to the specified X and Y position.
 * Go to  Moves the sprite to the mouse-pointer or another sprite.
 * Glide Secs to X:  Y:   Glides the sprite to the location, taking as long as the specified amount of time.
 * Change X by  Changes the sprite's X position by the amount.
 * Set X to  Sets the sprite's X position to the amount.
 * Change Y by  Changes the sprite's Y position by the amount.
 * Set Y to  Sets the sprite's Y position to the amount.
 * If on Edge, Bounce If touching the edge of the screen, the sprite's direction flips over.
 * This sets the rotation style of a sprite.

Scratch 2.0 has the following three Motion Reporter blocks:


 * X Position The X position of the sprite.
 * Y Position The Y position of the sprite.
 * Direction The direction of the sprite.

Looks blocks
Looks blocks are the blocks that control a sprite's look. There are 23 Looks blocks in Scratch 2.0. Three of the 19 sprite Looks blocks have a counterpart for the Stage.

Scratch 2.0 has the following sixteen Looks Stack blocks:


 * Say for  Secs  A speech bubble appears over the sprite and stays for the specified amount of time.
 * Say  A speech bubble appears over the sprite and will not go away over time.
 * Think for  Secs  A thought bubble appears over the sprite and stays for the specified amount of time.
 * Think  A thought bubble appears over the sprite and will not go away over time.
 * Show Shows the sprite.
 * Hide Hides the sprite.
 * Switch Costume to /Switch Backdrop to  Changes the sprite's/Stage's costume/backdrop to the specified one.
 * Switch Backdrop to and wait  Like the Switch to Backdrop  block, though it waits until all of the hat blocks triggered by this have completed. (Stage only)
 * Next Costume/Next Backdrop Changes the sprite's/Stage's costume/backdrop to the next one in the costume list.
 * Change Effect by   Changes the specified effect by the amount.
 * Set Effect to   Sets the specified effect to the amount.
 * Clear Graphic Effects Clears all graphic effects on the sprite.
 * Change Size by  Changes the sprite's size by the amount.
 * Set Size to % Sets the sprite's size to the amount.
 * Go to Front Puts a sprite in the front.
 * Go Back Layers  Changes the sprite's layer value by the amount.

Scratch 2.0 has the following three Looks Reporter blocks:


 * Costume # (for sprites) / Backdrop # (for the Stage) The number of the sprite/Stage's current costume/backdrop in the list.
 * Backdrop Name  Reports the name of the current backdrop.
 * Size The sprite's size.

Sound blocks
Sound blocks are the blocks that control sound and MIDI functions. There are 13 Sound blocks in Scratch 2.0.

Scratch 2.0 has the following eleven Sound Stack blocks:


 * Play Sound  Plays a sound without pausing the script.
 * Play Sound Until Done  Plays a sound and pauses the script until it finishes.
 * Stop All Sounds Stops all playing sounds.
 * Play Drum for  Beats  Plays the specified drum for the amount of beats.
 * Rest for Beats  Pauses the script for the amount of time.
 * Play Note for  Beats  Plays the note for the amount of beats.
 * Set Instrument to  Sets the instrument to the specified one.
 * Change Volume by  Changes the volume by the amount.
 * Set Volume to %  Sets the volume to the amount.
 * Change Tempo by  Changes the tempo by the amount.
 * Set Tempo to bpm  Sets the tempo to the amount.

Scratch 2.0 has the following two Sound Reporter blocks:


 * Volume The volume.
 * Tempo The tempo.

Pen blocks
Pen blocks are the blocks that control the pen. There are 11 Pen blocks in Scratch 2.0.

Scratch 2.0 has the following eleven Pen Stack blocks:


 * Clear Removes all pen marks put on the screen.
 * Stamp Pens the sprite's image on the screen. Can be removed using clear.
 * Pen Down Puts the sprite's pen down.
 * Pen Up Puts the sprite's pen up.
 * Set Pen Color to (color-picker)  Sets the pen color to the specified color shown on the picture.
 * Change Pen Color by  Changes the pen color by the amount.
 * Set Pen Color to (number)  Sets the pen color to the amount.
 * Change Pen Shade by  Changes the pen shade by the amount.
 * Set Pen Shade to  Sets the pen shade to the amount.
 * Change Pen Size by  Changes the pen size by the amount.
 * Set Pen Size to  Sets the pen size to the amount.

The Scratch Day pre-alpha of Scratch 2.0 had the following one new Pen Stack block:


 * Stamp Transparent  Pens the sprite's image on the screen at the transparency of the amount in the block. Can be removed using clear. This was made obsolete, because now ghost effect is respected when stamping.

Variables blocks
Variables blocks are the blocks that hold values and strings. There are 5 Variables blocks in Scratch 2.0.

Scratch 2.0 has the following four Variables Stack blocks:


 * Set to   Sets the specified variable to the amount.
 * Change by   Changes the specified variable by the amount.
 * Show Variable  Shows the variable's Stage Monitor.
 * Hide Variable  Hides the variable's Stage Monitor.

Scratch 2.0 has the following Variables Reporter block:


 * The variable's value.

List blocks
List blocks are the blocks that manage lists. They are stored in the Data category. There are 10 List blocks in Scratch 2.0.

Scratch 2.0 has the following six List Stack blocks:


 * Add to   Adds an item to the list (the item goes at the bottom of the list of items) with the specified content in it.
 * Delete of   Deletes the item of the list.
 * Insert at  of   Adds an item to the list (the item goes where you specify in the list of items) with the specified content in it.
 * Replace Item of  With   Replaces the item's content with the specified content.
 * Show list  Shows a list.
 * Hide list  Hides a list.

Scratch 2.0 has the following 3 List Reporter blocks:


 * The list's value.
 * Item of   The item's value.
 * Length of  How many items there are in the specified list.

Scratch 2.0 has the following List Boolean block:


 * Contains  The condition for checking if an item's content is the specified text.

Event blocks
Event blocks are blocks that control events and the triggering of scripts. There are 8 Event blocks in Scratch 2.0.

Scratch 2.0 has the following six Event Hat Blocks:


 * When Green Flag Clicked When the flag is clicked, the script activates.
 * When Key Pressed  When the specified key is pressed, the script activates.
 * When This Sprite Clicked When the sprite is clicked, the script activates.
 * When Backdrop Switches to  When the backdrop switches to the one chosen, the script activates.
 * When is greater than   When the first value is greater than the second value, the script activates.
 * When I Receive  When the broadcast is received, the script activates.

Scratch 2.0 has the following two Event Stack blocks:


 * Broadcast  Sends a broadcast throughout the Scratch program, activating When I Receive  blocks that are set to that broadcast.
 * Broadcast and Wait  Like the Broadcast  block, but pauses the script until all scripts activated by the broadcast are completed.

Control blocks
Control blocks are the blocks that control scripts. There are 11 Control blocks in Scratch 2.0.

Scratch 2.0 has the following one Control Hat block:


 * When I Start as a Clone (sprites only)  This hat block is triggered whenever a clone is created, and will only be run by that clone.

Scratch 2.0 has the following three Control Stack blocks:


 * Wait Secs  Pauses the script for the amount of time.
 * Wait Until  Pauses the script until the condition is true.
 * Create Clone of  Creates the specified clone.

Scratch 2.0 has the following five Control C blocks:


 * Repeat  A loop that repeats the specified amount of times.
 * Forever A loop that will never end.
 * If Then  Checks the condition so that if the condition is true, the blocks inside it will activate.
 * If Then, Else  Checks the condition so that if the condition is true, the blocks inside the first C will activate and if the condition is false, the blocks inside the second C will activate.
 * Repeat Until  A loop that will stop once the condition is true.

Scratch 2.0 has the following two Control Cap blocks:


 * Stop  Stops the scripts chosen through the drop-down menu. Can also be a stack block when "other scripts in this sprite" is chosen.
 * Delete This Clone (sprites only)  Deletes a clone.

Sensing blocks
Sensing blocks are the blocks that detect things. There are 20 Sensing blocks in Scratch 2.0.

Scratch 2.0 has the following four Sensing Stack blocks:


 * Ask and Wait  An input box appears  you type the value in and it stores the value in the answer variable.
 * Reset Timer Resets the timer.
 * Turn Video  Turns the video on.
 * Set Video Transparency to % Sets the transparency of the video.

Scratch 2.0 has the following five Sensing Boolean blocks:


 * Touching ? The condition for checking if the sprite is touching the mouse-pointer or another sprite.
 * Touching Color ? The condition for checking if the sprite is touching a specific color.
 * Color is Touching ?  The condition for checking if a color on the sprite is touching a specific color.
 * Key Pressed?  The condition for checking if the specified key is being pressed.
 * Mouse Down? The condition for checking if the mouse is down.

Scratch 2.0 has the following eleven Sensing Reporter blocks:


 * Distance to  The distance from the sprite to the mouse-pointer or another sprite.
 * Answer The most recent input with the Ask  And Wait block.
 * Mouse X The mouse-pointer's X position.
 * Mouse Y The  mouse-pointer's Y position.
 * Loudness How loud the noise is that the microphone is sensing.
 * Timer How much time has passed since the Scratch program was opened or the timer reset.
 * Video on   The video motion or direction of video motion on an object.
 * of  The X position, Y position, direction, costume, size or volume of the Stage or a sprite.
 * Current  The specified time unit selected.
 * Days Since 2000 The number of days since 2000.
 * Username The username of a user.

Operators blocks
Operators blocks are the blocks that perform math functions and string handling. There are 17 Operators blocks in Scratch 2.0.

Scratch 2.0 has the following six Operators Boolean blocks:


 * <  The condition for checking if a value is less than the other.
 * =  The condition for checking if two values are equal.
 * >  The condition for checking if a value is greater than the other.
 * and  Joins two conditions.
 * or  Joins two conditions, but they function separately.
 * Not  Makes the condition checked if it is false, not true.

Scratch 2.0 has the following eleven Operators Reporter blocks:


 * +  The value of the addition.
 * -  The value of the subtraction.
 * *  The value of the multiplication.
 * /  The value of the division.
 * Pick Random to   Picks a random number between the two limits.
 * Join  The two values put right next to each other.
 * Letter of   The specified character of the value.
 * Length of  The length of the value.
 * Mod  The remainder of the division.
 * Round  Rounds the value to the nearest whole number.
 * of  The absolute value (abs), square root (sqrt), sine (sin), cosine (cos), tangent (tan), asine (asin), acosine (acos), atangent (atan), natural logarithm (ln), logarithm (log), exponential function (e^), or base 10 exponential function (10^) of a specified value.

Right clicking some of the blocks will yield more choices of its type.

More blocks
More blocks are user-made custom blocks. There are 2 unique kinds of More blocks in Scratch 2.0.

Scratch 2.0 has the following More Modified Hat block:
 * Define  Defines a custom block.

Scratch 2.0 has the following More Stack block:
 * A custom block.

PicoBoard blocks
PicoBoard blocks are used to control and sense data from the PicoBoard.

Scratch 2.0 has the 2 following PicoBoard Hat blocks:
 * When
 * When

Scratch 2.0 has the following PicoBoard Boolean block:
 * Sensor ?

Scratch 2.0 has the following PicoBoard Reporter block:
 * Sensor Value

LEGO WeDo blocks
LEGO WeDo blocks are used to control the LEGO WeDo. They are accessed via the Add an Extension button.

Scratch 2.0 has the following five LEGO WeDo Stack blocks:
 * Turn Motor On for Secs
 * Turn Motor On
 * Turn Motor Off
 * Set Motor Power
 * Set Motor Direction

Scratch 2.0 has the following two LEGO WeDo Hat blocks:
 * When Distance <
 * When Tilt =

Scratch 2.0 has the following two LEGO WeDo Reporter blocks:
 * Distance
 * Tilt

Scratch Block Plugin
The Scratch Block Plugin allows blocks and scripts to be used in the Scratch Forums and Scratch Wiki, as well as other sites with the included JavaScript. They look like this: when flag clicked go to x: (0) y: (0) // center the sprite for the first stamp stamp forever go to x: (pick random (-240) to (240)) y: (0) stamp wait (0.2) secs change [color v] effect by (pick random (5) to (14)) The current version that includes all blocks from Scratch 2.0 was made by blob8108.

Editing the Block Colors


In the online Scratch 2.0 editor, by shift-clicking the Edit menu an option called "Edit block colors" appears. By selecting this, a menu will appears with a few color sliders and tools for modifying the block colors of a specific block category. Personalized colors can be saved to one's computer, but loading the colors currently does not work properly.

In Other Programming Languages
Scratch is one of the original languages ever to use blocks, inspiring other languages to inherit the idea. Scratch modifications contain many new blocks typically that are not present in Scratch. MIT, at which Scratch is designed, has also created other languages using blocks such as the MIT App Inventor. Stencyl is a highly-professional language that features an entire block interface for programming real-time apps and online games. Scratch Jr also has blocks which are even more friendly for younger children to understand.