Getting Started
RCaron is currently unusable as a shell, a little usable as a scripting language.
Installation
You can install the RCaron shell as a global tool with the following command, requires .NET 7:
dotnet tool install -g RCaron.Shell
dotnet tool install -g RCaron.Shell
You can then run the shell with the rcaron command.
Also see a guide on configuring the shell
Hello World
rcaronprint 'Hello World!'
rcaronprint 'Hello World!'
You can put this code in a file and run it with rcaron <file>, or you can also just start the shell with rcaron and then type the code in.
A bigger example
A simple number guessing game currently looks like this:
rcaron// we "open" a .NET namespace with openopen 'System'// to use a .NET type we start it's name with a '#' and then access it's members with ':'// from there we access the members of a variable, property or whatever with '.'// variables don't have to be declared$number = #Random:Shared.Next(1, 10000)print 'Guess a number between 1 and 10000'// 'loop' is a loop that can be exited with 'break'loop {#Console:Write('Your guess: ')$guess = #Int32:Parse(#Console:ReadLine())// 'print' is a built-in function that prints arguments to the console with a space between themprint 'You guessed:' $guess// operators look normalif ($guess < $number) {print 'Too low'}else if ($guess > $number) {print 'Too high'}else {print 'You guessed it!'break}}print 'congrats'
rcaron// we "open" a .NET namespace with openopen 'System'// to use a .NET type we start it's name with a '#' and then access it's members with ':'// from there we access the members of a variable, property or whatever with '.'// variables don't have to be declared$number = #Random:Shared.Next(1, 10000)print 'Guess a number between 1 and 10000'// 'loop' is a loop that can be exited with 'break'loop {#Console:Write('Your guess: ')$guess = #Int32:Parse(#Console:ReadLine())// 'print' is a built-in function that prints arguments to the console with a space between themprint 'You guessed:' $guess// operators look normalif ($guess < $number) {print 'Too low'}else if ($guess > $number) {print 'Too high'}else {print 'You guessed it!'break}}print 'congrats'
Beware
- The
*and/arithmetic operators require a space after them, so1*2is invalid, but1 * 2is valid. This is because they would end up getting parsed as a path. - Numbers are parsed as
longby default, so1 / 10ends up being0. To get0.1you have to write1.0 / 10.0or1 / 10.0or1.0 / 10.