gem install sardonyx
Nobody likes an overcomplicated language. For example, in C++ what even is std::cout << "Hello, world!"
? The arbitrary choice of std::cout
and the confusing <<
operator makes learning hard. In Sardonyx, simplicity is key. And no, we don't mean verbose. We're not asking you to write an essay just to write some code. We focus on the well known, traditional programming, but we don't overcomplicate it.
Who says curly braces aren't elegant? Sardonyx takes a more traditional language syntax and streamlines and modernizes it.
Ever had to write 50 lines of code to do something simple? Ever look at a line of code, and it seems nonsensical? Sardonyx aims to be concise. Write the right amount of code, not too long, not too short.
gem install sardonyx
.#>
This is a comment and will be used to explain the code.
This code will calculate the factorial of the 5.
<#
# The require statements import packages. Here the "stdio" and "list" packages are being imported from the standard library.
require "stdio"
require "list"
# Define variables n - the number whose factorial is to be calculated and o - The result.
n = 5
o = 1
# Loop from 1 to n + 1, end-exclusive
for List:Range(1, n + 1) {
o = o * _ # Multiply the output by the current value (which is being accessed using _)
}
# Write the result using the writeln function from the stdio package.
Stdio:writeln("The factorial of " + n.__as_str() + " is " + o.__as_str())