Welcome to the robin documentation!
This course will guide you through everything you need to know on robin!
If you have any questions about robin, feel free to contact support or email me!
robin
folder, and follow these steps:
cd Desktop/robin && sh start.sh
(assuming you’ve stored the file on your Desktop), and click enter. It will take a few seconds, and after you get a message that says ‘robin is installed’, you can close your Terminal/Command line and delete the robin folder on your Desktop.To create a file, you can type in robin create Desktop/index.robin
. This will create a file called index.robin
on your desktop. Now, you can right click the file and open it using your text editor, and type in your. code. Once you’re done, save the file (Ctrl+S) and go back to your Command line.
Now, type in robin run Desktop/index.robin
. This will run your file and give you an output.
Robin has a cool feature where, unlike other languages, you don’t have to keep typing robin run filename
if you make any changes. You will only have to run the command once, and every time you save the file, it will restart automatically!
Here is the syntax, functions and methods currently supported by robin.
To create a variable, type in set variableName to variableValue
The following code will create a variable a with a value of 3:
set a to 3
You don’t have to store just numbers. You can store letters too!
For example,
set a to ‘Hello robin!’
You can even set it to true or false (boolean) values!
set isRobinCool to true
This is how you can print text to the console using robin:
print ‘Hello robin!’ to the console
You can also print numbers, boolean values, and even variables:
print 43 to the console
print false to the console
set a to 'hey!'
print a to the console
You can also combine them all!
set a to 'hello'
print a + ' robin!'
The above code will print “hello robin!” to the console.
Sometimes, you may need to write additional text, which you don’t want to be executed when the code runs. You can use something called comments. This is how you use comments in robin:
set a to 'hello' //this will create a variable a to the value 'hello'
The text (this will… value ‘hello’) will not be run because it starts with //
, which is ignored by robin.
robin has a few reserved words, or keywords, that are used by the compiler when it is run. For example, the word set
is a robin keyword.
But what if you wanted to print the word set
to the console?
You can add a caret (^
) anywhere in the keyword, so that the word is ignored.
For example,
print 'I just s^et a variable!' to the console
//This will output: "I just set a variable!"
Since robin is in its earliest stages, this is one bug that makes writing in robin slightly more laborious than it should be, but I am working on a fix.
Here are the operators supported in robin:
All arithmetic operators start and end with a $
sign.
$add someNumber and otherNumber$
print $add 2 and 3$ to the console
//this will print 5 (=2+3).
$subtract someNumber and otherNumber$
print $subtract 7 and 5$ to the console
//this will print 2 (=7-5).
$multiply someNumber and otherNumber$
print $multiply 4 and 5$ to the console
//this will print 20 (=4*5).
$divide someNumber and otherNumber$
print $multiply 20 and 5$ to the console
//this will print 4 (=20/5).
There are a few other functions in robin which are also helpful:
get a number from $1 to 4$
This will give you a number from 1 to 4, but there’ll also be a long line of trailing decimals. To remove those decimals, we’ll have to round off that number.round off $4566.7565$
If you wanted to round of a number from 1 to 4, as seen in the last example, you will have to do:
round off $get a number from $1 to 4$$
Relational operators can help you compare two values. Here are all the relational operators in robin:
3 is greater than 4 //will output false
7 is lesser than 210 //will output true
20 is equal to 20 //will output true
8 is greater than or equal to 9 //will output false
9 is lesser than or equal to 9 //will output true
We will learn more about where we can use these in the next section.
If/Else statements can be used to compare two values, and then execute something based on the output of the comparison.
This is how you use an If function in robin:
if $1 is greater than 2$,
print '1 > 2!' to the console
end
This will print “1 > 2” if the comparison is true. But 1 is lesser than 2, so this function would never execute. An Else function would help us get a value if it isn’t true:
if $1 is greater than 2$,
print '1 > 2!' to the console
otherwise,
print '2 > 1' to the console
end
What if you wanted to execute something after a delay?
In robin, you can do this:
create a delay of 5000 then //Delay time is in milliseconds
print '5 seconds are up!' to the console
finish
Functions are a way to keep code inside a container so you don’t have to repeatedly type in the code. They can also be called with a single line, anywhere in your file.
Here’s how you can create functions in robin:
create a function printHelloWorld which will
print 'hello world!' to the console
end
To call the above function, type in,
start printHelloWorld please
What if you wanted to pass values into the function? For that, do:
create a function add which takes num1 and num2 then,
print $add num1 and num2$ to the console
end
To call this function,
start add with values of $5 and 7$
robin also has a few other cool features that other languages may not have.
Here are a few date and time related functions, with some examples:
print the time to the console //12:00:00
print the period to the console //AM or PM
print the second to the console //56
print the minute to the console //40
print the date to the console //3
print the day to the console //Monday
print the year to the console //2022
print the name of the month to the console //January
print the number of the month to the console //1
You can use these anywhere you would use variables, except for setting a value.
robin supports encryption too! It uses a slightly better version of an encoding specification called AES-256, called PidgonCrypt. To use it, type in:
print encrypt $'hello robin!'$ to the console
This would give out a value that looks like 8b3b6a81101b3afefb15229f12fe6ded3e3f19a4ba56c1a6d60f94b0c416dcc4
To decrypt a value, type in:
print decrypt $'9ae3abb363c2dfbb0efa87a34e306fe9'$ to the console
If (for some reason) you have encrypted your robin code with PidgonCrypt, you can execute the code by running robin run filename --secure
This is slightly advanced (and also , but robin allows you to host text in the form of html or plaintext on your machine’s localhost or 127.0.0.1 IP. To use it, type in:
create a text server that says 'Some text' at port $3000$
If this code is executed, the text ‘Some text’ will be visible at http://localhost:3000.