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 myfunction2
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.
The first way to set a comment, is just by using the word “comment”
comment This part of the code is a comment and it's not executed.
Alternatively, a comment can be set by using a hash “#”
# This part of the code is a comment and it's not executed.
This is the case in Robin as well. Below, we have a multiline comment.
comment This is a multiline comment\ Which continues to the next line.
The multiline comment can only be used with the first method. The hash “#” method is used for single line comments.
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”.