-
Notifications
You must be signed in to change notification settings - Fork 3
String reverser breakdown

This sample reverses the string "Reversed" and prints it out.
Here you can find the color scheme used. Without it, obtained via the standardize command (plus some manual recoloring), it would look like this:

Which can be decompacted into:

Line by line explanation:
-
"Reversed" is saved into a variable
.
-
An empty string (final output) is saved into another variable
. The black
pixel is a non-displayed character that forces a string initialization.
-
A for-each
is used on our string
which is read character by character.
-
A
lambda.openopens the sub-block and takes an argument
(the character of the string which is being read).
-
The output variable
gets updated: its new value is: current char
+ output value
.
Again, the black pixelis used to force string concatenation between the values.
-
lambda.closecloses the for-each block.
-
Print
is called on the output value
.
desreveRis the output.
.
. The black
pixel is a non-displayed character that forces a string initialization.
is used on our string
opens the sub-block and takes an argument
(the character of the string which is being read).
closes the for-each block.
is called on the output value