What is Syntactic Sugar?
In computer science, syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It’s like a “shortcut” provided by the language that makes the language “sweeter” for human to use.
Gandi IDE introduces some syntactic sugar blocks to Scratch.
Modules
Module | Description |
Mathematics | - Some mathematical operators that are not supported by Scratch. |
String | - Advanced operations on strings. |
Utils | - Extended possibilities. |
Functions and Definitions
Mathematics
Calculate the base raised to the power of the exponent.
Input | Description | Example Value |
base | The base in exponentiation. | 2 |
exponent | The exponent in exponentiation. | 10 |
Coding with basic blocks
Coding with sugar blocks
Check if a value is greater/less than or equal to another value.
Coding with basic blocks
Coding with sugar blocks
String
Return different values determined by the result of the condition.
Coding with basic blocks
Coding with sugar blocks
Return a part of a string.
Coding with basic blocks
Coding with sugar blocks
Split a string with another string and return one of the results.
Input | Description | Example Value |
original string | The original string which needs to be split. | The quick brown fox jumps over the lazy dog. |
string | The string used to split the original string. | jumps over |
item number | The number of items to be returned. | 1 |
Selection | Description |
return value | When the item number is out of range, what value will be returned? There are three options:
- the last string: Return the last item after splitting.
- an empty string: Return an empty string.
- false: Return false. |
Coding with basic blocks
Coding with sugar blocks
Utils
Customize an event that will be dispatched by a condition. The input should be a boolean block.
Copy a string to the clipboard.