In Robin, particular blocks of commands are nested in a block whose end is marked as “end”. These are commands included in conditionals, in loops, functions and other similar concepts.
In the example below, an if conditional is used. If VarA is 0, then VarB will take the value False. Conversely, if VarA is 1, VarB will be True. In the event that there is another value for VarA, VarB will be “empty”.
The three assignment statements, will be nested under each section of the condition.
if VarA = 0 then set VarB to 'False' else if VarA = 1 then set VarB to 'True' else set VarB to 'empty' end
function functionname set g:output1 to 1 end call functionname
As in all programming languages, commenting is a very important aspect required to allow developers set placeholders for future implementations as well as to keep track of what each section performs.
A comment in Robin can be set by using a hash “#”
# This part of the code is a comment and it's not executed.
Alternatively, to set a multi-line comment, use the /# at the beginning and #/ at the end of the section to be commented.
/# This is a multiline comment Which continues to the next line. #/
A multiline comment can be set by
Note that in Robin particular symbols are used in commands for specific purposes. For example to set a text value to a variable, the text needs to be within single, double, or tripple quotes.
In case there is the same quotes used in the text as well, the symbol can be escaped using a backslash (\)
set TextVar to 'That\'s a quote used within the text.'
In Robin, all commands that are used in an automation are executed one by one sequentially.
In order to prevent one command from executing without removing it, just disable it.
The word “disable” in the beginning of the line disables the action.
disable set x to 1
disable block loop i from 1 to 100 set x to i
Using the disable without the block in a loop will disable the parent command, however the nested commands will be executed. For conditionals the “disable” keyword equals the “disable block”.