-
Notifications
You must be signed in to change notification settings - Fork 0
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.open
opens 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 pixel is used to force string concatenation between the values. -
lambda.close
closes the for-each block. -
Print is called on the output value .
desreveR
is the output.