includeArray# Include the Array standard library# Create an array instance using the Array class
-vararr=Array([1,2,3,4,5])
+arr=Array([1,2,3,4,5])print(arr.len())# 5print(arr.is_empty())# false
@@ -1009,7 +1056,6 @@
We are excited to announce the launch Radon - a new open source programming language for the modern world. The language is designed to be simple, fast, and safe while incorporating modern language features such as type inference, pattern matching, and more. A key goal of the language is to be easy to learn and use, while still being powerful enough to build complex applications. It is also designed to be easy to embed in other applications, and to be used as a scripting language. The language is currently in the early stages of development, and we are looking for contributors to help us build the language.
+
We are excited to announce the launch Radon -
+a new open source programming language for the modern world.
+The language is designed to be simple, fast, and safe while incorporating modern
+language features such as type inference, pattern matching, and more.
+A key goal of the language is to be easy to learn and use, while still being
+powerful enough to build complex applications. It is also designed to be easy
+to embed in other applications, and to be used as a scripting language.
+The language is currently in the early stages of development, and we are
+looking for contributors to help us build the language.
Md. Almas Ali is a software engineer and a programming language enthusiast. He is the creator of the Radon programming language. He has a lot of projects in his GitHub profile. Checkout his GitHub profile for more information.
+
Md. Almas Ali is a software engineer and a programming language
+enthusiast. He is the creator of the Radon programming language. He has a lot
+of projects in his GitHub profile. Checkout his GitHub profile
+for more information.
Built-in functions are the functions that are built into the language. They are used to perform common tasks. In Radon, there are a list of built-in functions that are available to use. They are:
+
Built-in functions are the functions that are built into the language.
+They are used to perform common tasks. In Radon, there are a list of
+built-in functions that are available to use.
Object Oriented Programming (OOP) is a programming paradigm that uses objects and their interactions to design and program applications. It is based on the concept of objects rather than just functions and procedures. These objects are organized into classes, which allow individual objects to be grouped together. Most modern programming languages including Java, C/C++, and Python are object-oriented languages, and many older programming languages now have object-oriented versions.
-
In Radon, we also have support for OOP. We can create classes and objects. We can also create methods and fields.
Let's start by creating a class. We can create a class using the class keyword. It is followed by the name of the class and the body of the class. The body of the class is enclosed in curly braces.
+
Object Oriented Programming (OOP) is a programming paradigm that uses objects
+and their interactions to design and program applications. It is based on the
+concept of objects rather than just functions and procedures. These objects
+are organized into classes, which allow individual objects to be grouped
+together. Most modern programming languages including Java, C/C++, and Python
+are object-oriented languages, and many older programming languages now have
+object-oriented versions.
+
In Radon, we also have support for OOP. We can create classes and objects.
+We can also create methods and fields.
Let's start by creating a class. We can create a class using the class
+keyword. It is followed by the name of the class and the body of the class.
+The body of the class is enclosed in curly braces.
Now that we have created a class, we can create an object. We can create an object by simply calling the class like as a function. It is followed by the name of the class and the arguments in parentheses. The arguments are optional.
Now that we have created a class, we can create an object. We can create an
+object by simply calling the class like as a function. It is followed by the
+name of the class and the arguments in parentheses. The arguments are optional.
Fields are the variables that are declared inside a class. They are used to store data. They are also called instance variables because they are unique to each instance of the class. They are declared using the var keyword. It is followed by the name of the field and the type of the field. The type of the field is optional.
+
Fields are the variables that are declared inside a class. They are used to
+store data. They are also called instance variables because they are unique
+to each instance of the class. They are declared using the var keyword. It
+is followed by the name of the field and the type of the field.
+The type of the field is optional.
Constructors are special methods that are used to initialize the fields of a class. They are called when an object is created. They are declared using the fun keyword. It is followed by the name (class name) of the constructor and the parameters in parentheses. The parameters are optional.
+
Constructors are special methods that are used to initialize the fields of a
+class. They are called when an object is created. They are declared using the
+fun keyword. It is followed by the name (class name) of the constructor and
+the parameters in parentheses. The parameters are optional.
Methods are the functions that are declared inside a class. They are used to define the behavior of the class. They are declared using the fun keyword. It is followed by the name of the method, the parameters in parentheses, and the return type. The parameters and the return type are optional.
+
Methods are the functions that are declared inside a class. They are used to
+define the behavior of the class. They are declared using the fun keyword.
+It is followed by the name of the method, the parameters in parentheses, and
+the return type. The parameters and the return type are optional.
We need contributors to help us build the language. If you are interested, please make contributions to the radon-project/radon repository.
+
We need contributors to help us build the language. If you are interested,
+please make contributions to the radon-project/radon repository.
Steps to contribute:
-
Fork the repository
-
Clone the repository
-
Create a new branch
-
Make changes
-
Commit changes
-
Push to the branch
-
Create a pull request
+
Fork the repository.
+
Clone the repository.
+
Create a new branch.
+
Make changes.
+
Commit changes.
+
Push to the branch.
+
Create a pull request.
-
Before making a pull request create an issue and discuss the changes you want to make. If you have any questions, feel free to ask in the issues section.
+
Before making a pull request create an issue and discuss the changes you want to
+make. If you have any questions, feel free to ask in the issues section.
Conditional statements are used to execute code based on a condition. In Rain, the if statement is used to execute code if a condition is true. The else statement is used to execute code if the condition is false. The elif statement is used to execute code if the condition is false and another condition is true. The else statement is optional.
+
Conditional statements are used to execute code based on a condition. In Rain,
+the if statement is used to execute code if a condition is true. The else
+statement is used to execute code if the condition is false. The elif
+statement is used to execute code if the condition is false and another
+condition is true. The else statement is optional.
a=[1,2,3];// a is an array of ints
+b=[1.0,2.0,3.0];// b is an array of floats
+c=["a","b","c"];// c is an array of strings// Arrays can be nested
-vard=[[1,2],[3,4]]// d is an array of arrays of ints
-
-// Arrays can be empty
-vare=[]// e is an empty array of unknown type
+d=[
+[1,2],
+[3,4],
+];// d is an array of arrays of ints
+
+// Arrays can be empty
+e=[];// e is an empty array of unknown type
vara={x:1,y:2}// a is an object with fields x and y of type int
-varb={x:1.0,y:2.0}// b is an object with fields x and y of type float
-varc={x:"a",y:"b"}// c is an object with fields x and y of type string
-
-// Objects can be nested
-vard={x:{y:1,z:2},w:{y:3,z:4}}// d is an object with fields x and w of type object
+
Objects are declared using the {} syntax. The type of the object is the
+type of the fields it contains.
// a is an object with fields x and y of type int
+a={x:1,y:2};
+// b is an object with fields x and y of type float
+b={x:1.0,y:2.0};
+// c is an object with fields x and y of type string
+c={x:"a",y:"b"};
-// Objects can be empty
-vare={}// e is an empty object of unknown type
+// Objects can be nested
+// d is an object with fields x and w of type object
+d={x:{y:1,z:2},w:{y:3,z:4}};
+
+// Objects can be empty
+// e is an empty object of unknown type
+e={};
To handle exceptions, we use the try and catch blocks. The try block
+contains the code that may throw an exception. The catch block contains
+the code that handles the exception.
try{
+// code that may throw an exception
+a=1/0
+}catchaserr{
+// code that handles the exception
+print("Exception caught: "+err)
+}
+
+
Output:
+
Exceptioncaught:Divisionbyzero
+
+
Don't forget to use the as keyword to assign the exception to a variable.
+The variable can be used to get the exception message. If you don't want to
+use the exception message, you can omit the variable.
To raise an exception, we use the raise keyword followed by the exception
+type and the message. We have builtin exceptions in radiation module. We can
+use them to raise exceptions.
When the exception is raised, the program stops executing and the exception is
+propagated up the call stack. The exception can be caught by a try block. If
+the exception is not caught, the program stops executing and the exception
+is printed to the console.
File handling is an essential part of any programming language. Radon provides
+a simple way to read and write files. In this section, we will learn how to
+read and write files in Radon.
When opening a file, we can specify the mode in which we want to open the file.
+
The modes are:
+
+
r: Read mode. Opens the file for reading. The file must exist.
+
w: Write mode. Opens the file for writing. If the file does not exist,
+ it creates a new file. If the file exists, it truncates the file.
+
a: Append mode. Opens the file for writing. If the file does not exist,
+ it creates a new file. If the file exists, it appends the content to the file.
+
r+: Read and write mode. Opens the file for reading and writing.
+ The file must exist.
+
w+: Write and read mode. Opens the file for reading and writing.
+ If the file does not exist, it creates a new file. If the file exists,
+ it truncates the file.
+
a+: Append and read mode. Opens the file for reading and writing.
+ If the file does not exist, it creates a new file. If the file exists,
+ it appends the content to the file.
To manipulate files in Radon, we use built-in File class. We can create a new
+instance of File class by passing the file path to the constructor. We can
+then use the read method to read the contents of the file.
Functions are the building blocks of a task. They are used to define the behavior of the program. In Radon, we declare functions using the fun keyword. It is followed by the name of the function, the parameters, and the return type. The body of the function is enclosed in curly braces.
+
Functions are the building blocks of a task. They are used to define the
+behavior of the program. In Radon, we declare functions using the fun keyword.
+It is followed by the name of the function, the parameters, and the return type.
+The body of the function is enclosed in curly braces.
Function parameters are the names listed in the function definition. They are used to pass values into the function. The parameters are separated by commas. The parameters are optional.
+
Function parameters are the names listed in the function definition. They are
+used to pass values into the function. The parameters are separated by commas.
+The parameters are optional.
We can also leave out the parentheses if there are no parameters.
Radon is a programming language that is designed to be easy to learn and use. It is a high-level language intended to be used for general purpose programming. It is designed to be easy to learn and use, while still being powerful enough to be used for most tasks. Some of the features of Radon include:
+
Radon is a programming language that is designed to be easy to learn and use.
+It is a high-level language intended to be used for general purpose programming.
+It is designed to be easy to learn and use,
+while still being powerful enough to be used for most tasks.
+
Some of the features of Radon include:
A simple syntax that is easy to learn and use
Dynamic typing so that you don't have to worry about types
Login Logic}}
-varusername=input("Enter you username: ")
-varpassword=input("Enter your password: ")
+username=input("Enter you username: ")
+password=input("Enter your password: ")
-varnetwork=Network(username,password)
+network=Network(username,password)network.login()
In Radon, we can print to the console using the print function. It is followed by the argument in parentheses. The argument are mandatory. It takes only one argument. We can concatenate data types using the + operator.
+
In Radon, we can print to the console using the print function.
+It is followed by the argument in parentheses. The argument are mandatory.
+It takes only one argument. We can concatenate data types using the + operator.
In Radon, we can take input from the console using the input function. It is followed by the argument in parentheses. The argument are mandatory. It takes only one argument. We can concatenate data types using the + operator.
+
In Radon, we can take input from the console using the input function. It is
+followed by the argument in parentheses. The argument are mandatory. It takes
+only one argument. We can concatenate data types using the + operator.
It's easy to install Radon on your computer. Just go to the downloads page and download the latest version for your operating system. Then, follow the instructions below for your operating system. If you have any problems, please contact us and we'll help you out.
+
It's easy to install Radon on your computer. Just go to the
+downloads page
+and download the latest version for your operating system. Then, follow the
+instructions below for your operating system. If you have any problems, please
+contact us
+and we'll help you out.
To install Radon on Windows, just download the installer from the downloads page and run it. Then, follow the instructions on the screen to install Radon on your computer.
-
After setup you need to manually configure the PATH environment variable. To do this, open the Control Panel and go to System and Security > System > Advanced system settings > Environment Variables. Then, select the PATH variable and click Edit. Add the path to the Radon bin directory to the end of the variable value. For example, if you installed Radon in C:\Program Files (x86)\Radon, you would add C:\Program Files (x86)\Radon to the end of the variable value. Then, click OK to save the changes.
-
Quick tip: You can also set the PATH variable from the command line. Just open a command prompt and type the following command:
+
To install Radon on Windows, just download the installer from the
+downloads page
+and run it. Then, follow the instructions on the screen to install
+Radon on your computer.
+
After setup you need to manually configure the PATH environment variable.
+To do this, open the Control Panel and go to System and
+Security > System > Advanced system settings > Environment Variables.
+Then, select the PATH variable and click Edit. Add the path to the Radon bin
+directory to the end of the variable value. For example, if you installed
+Radon in C:\Program Files (x86)\Radon, you would add
+C:\Program Files (x86)\Radon to the end of the variable value.
+Then, click OK to save the changes.
+
Quick tip: You can also set the PATH variable from the command line.
+Just open a command prompt and type the following command:
Loops are used to execute a block of code multiple times. The block of code will be executed until the condition is true. This help us to reduce the code and execute the same block of code multiple times.
+
Loops are used to execute a block of code multiple times. The block of code will
+be executed until the condition is true. This help us to reduce the code and
+execute the same block of code multiple times.
Modules are a way to organize code in a way that is easy to reuse, test, and debug. Modules are also called packages, libraries, or frameworks. Modules are used to group related code together. For example, a module can be used to group code that is related to a specific task, such as sending an email. Modules are also used to group code that is related to a specific feature, such as a user interface.
+
Modules are a way to organize code in a way that is easy to reuse, test,
+and debug. Modules are also called packages, libraries, or frameworks.
+Modules are used to group related code together. For example, a module can
+be used to group code that is related to a specific task, such as sending
+an email. Modules are also used to group code that is related to a specific
+feature, such as a user interface.
A module is created by creating a file with the .rn extension. The file name is the name of the module. The name should have to be in Pascal Case PascalCase. The module have to implement the same name class as the file name. The class name should have to be in Pascal Case PascalCase.
+
A module is created by creating a file with the .rn extension. The file name
+is the name of the module. The name should have to be in Pascal Case PascalCase.
+The module have to implement the same name class as the file name. The class
+name should have to be in Pascal Case PascalCase.
A module is imported by using the include keyword. It is followed by the name of the module. The name of the module should have to be in Pascal Case PascalCase.
+
A module is imported by using the include keyword. It is followed by the name
+of the module. The name of the module should have to be in Pascal Case PascalCase.
To get started with Radon language you can use the built-in REPL or just run the Radon file. Run a Radon file by typing radon -s <filename>.rn in the command line. For example, if you have a file named hello.rn you can run it by typing radon -s hello.rn in the command line.
+
To get started with Radon language you can use the built-in REPL or just run
+the Radon file. Run a Radon file by typing radon -s <filename>.rn in the
+command line. For example, if you have a file named hello.rn you can run it
+by typing radon -s hello.rn in the command line.
The REPL is a command line interface that allows you to run Radon code interactively. To start the REPL, just type radon in the command line. You can then type Radon code and it will be executed immediately. To exit the REPL, just type exit() or press Ctrl + Z.
+
The REPL is a command line interface that allows you to run Radon code
+interactively. To start the REPL, just type radon in the command line.
+You can then type Radon code and it will be executed immediately. To exit the
+REPL, just type exit() or press Ctrl + Z.
The first program that most people write in a new language is the "Hello World" program. This program simply prints the words "Hello World" to the screen. Here is the "Hello World" program in Radon:
+
The first program that most people write in a new language is the "Hello World"
+program. This program simply prints the words "Hello World" to the screen. Here
+is the "Hello World" program in Radon:
Radon is a programming language that is designed to be easy to learn and use. It is a high-level language intended to be used for general purpose programming. It is designed to be easy to learn and use, while still being powerful enough to be used for most tasks. Some of the features of Radon include:
A simple syntax that is easy to learn and use
Dynamic typing so that you don't have to worry about types
Powerful standard library that makes it easy to do common tasks (Development)
Easy to use package manager that makes it easy to install packages (Future feature)
Functional programming support
Object-oriented programming support (Development)
Easy to use concurrency support (Future feature)
Easy to use GUI library (Future feature)
Easy to use web development library (Future feature)
# This is a Radon test file for the Radon Programming Language.\n\nclass Network {\n fun Network(username, password) {\n var this.username = username\n var this.password = password\n }\n\n fun login() {\n if this.username == \"radon\" {\n if this.password == \"password\" {\n print(\"Log in successful\")\n }\n } else {\n print(\"Invalid credentials\")\n }\n }\n}\n\nvar username = input(\"Enter you username: \")\nvar password = input(\"Enter your password: \")\n\nvar network = Network(username, password)\nnetwork.login()\n
"},{"location":"built-in-functions.html","title":"Built-in Functions","text":""},{"location":"built-in-functions.html#types-of-built-in-functions","title":"Types of built-in functions","text":"
Built-in functions are the functions that are built into the language. They are used to perform common tasks. In Radon, there are a list of built-in functions that are available to use. They are:
Object Oriented Programming (OOP) is a programming paradigm that uses objects and their interactions to design and program applications. It is based on the concept of objects rather than just functions and procedures. These objects are organized into classes, which allow individual objects to be grouped together. Most modern programming languages including Java, C/C++, and Python are object-oriented languages, and many older programming languages now have object-oriented versions.
In Radon, we also have support for OOP. We can create classes and objects. We can also create methods and fields.
Let's start by creating a class. We can create a class using the class keyword. It is followed by the name of the class and the body of the class. The body of the class is enclosed in curly braces.
Now that we have created a class, we can create an object. We can create an object by simply calling the class like as a function. It is followed by the name of the class and the arguments in parentheses. The arguments are optional.
Fields are the variables that are declared inside a class. They are used to store data. They are also called instance variables because they are unique to each instance of the class. They are declared using the var keyword. It is followed by the name of the field and the type of the field. The type of the field is optional.
fields.rn
class Person {\n var name = \"John\"\n var age = 20\n}\n
Constructors are special methods that are used to initialize the fields of a class. They are called when an object is created. They are declared using the fun keyword. It is followed by the name (class name) of the constructor and the parameters in parentheses. The parameters are optional.
constructors.rn
class Person {\n fun Person(name, age) {\n var this.name = name\n var this.age = age\n }\n}\n\nvar person = Person(\"John\", 20)\n
Methods are the functions that are declared inside a class. They are used to define the behavior of the class. They are declared using the fun keyword. It is followed by the name of the method, the parameters in parentheses, and the return type. The parameters and the return type are optional.
methods.rn
class Person {\n fun Person(name, age) {\n var this.name = name\n var this.age = age\n }\n\n fun sayHello() {\n print(\"Hello, \" + this.name + \"!\")\n }\n}\n\nvar person = Person(\"John\", 20)\nperson.sayHello() # Output: Hello, John!\n
"},{"location":"contribution.html","title":"Contribution","text":""},{"location":"contribution.html#how-to-contribute","title":"How to contribute","text":"
We need contributors to help us build the language. If you are interested, please make contributions to the radon-project/radon repository.
Steps to contribute:
Fork the repository
Clone the repository
Create a new branch
Make changes
Commit changes
Push to the branch
Create a pull request
Before making a pull request create an issue and discuss the changes you want to make. If you have any questions, feel free to ask in the issues section.
Conditional statements are used to execute code based on a condition. In Rain, the if statement is used to execute code if a condition is true. The else statement is used to execute code if the condition is false. The elif statement is used to execute code if the condition is false and another condition is true. The else statement is optional.
conditional-statements.rn
if true {\n print(\"true\")\n\n} else {\n print(\"false\")\n}\n
Arrays are declared using the [] syntax. The type of the array is the type of the elements it contains.
arrays.rn
var a = [1, 2, 3] // a is an array of ints\nvar b = [1.0, 2.0, 3.0] // b is an array of floats\nvar c = [\"a\", \"b\", \"c\"] // c is an array of strings\n\n// Arrays can be nested\nvar d = [[1, 2], [3, 4]] // d is an array of arrays of ints\n\n// Arrays can be empty\nvar e = [] // e is an empty array of unknown type\n
Objects are declared using the {} syntax. The type of the object is the type of the fields it contains.
objects.rn
var a = {x: 1, y: 2} // a is an object with fields x and y of type int\nvar b = {x: 1.0, y: 2.0} // b is an object with fields x and y of type float\nvar c = {x: \"a\", y: \"b\"} // c is an object with fields x and y of type string\n\n// Objects can be nested\nvar d = {x: {y: 1, z: 2}, w: {y: 3, z: 4}} // d is an object with fields x and w of type object\n\n// Objects can be empty\nvar e = {} // e is an empty object of unknown type\n
"},{"location":"functions.html","title":"Functions","text":""},{"location":"functions.html#types-of-functions","title":"Types of functions","text":"
Functions are the building blocks of a task. They are used to define the behavior of the program. In Radon, we declare functions using the fun keyword. It is followed by the name of the function, the parameters, and the return type. The body of the function is enclosed in curly braces.
Function parameters are the names listed in the function definition. They are used to pass values into the function. The parameters are separated by commas. The parameters are optional.
We can also leave out the parentheses if there are no parameters.
function_parameters.rn
fun sayHello(name) {\n print(\"Hello, \" + name + \"!\")\n}\n\nsayHello(\"World\") # Output: Hello, World!\n
"},{"location":"input-output.html","title":"Input Output","text":""},{"location":"input-output.html#printing-to-the-console","title":"Printing to the console","text":"
In Radon, we can print to the console using the print function. It is followed by the argument in parentheses. The argument are mandatory. It takes only one argument. We can concatenate data types using the + operator.
"},{"location":"input-output.html#input-from-the-console","title":"Input from the console","text":"
In Radon, we can take input from the console using the input function. It is followed by the argument in parentheses. The argument are mandatory. It takes only one argument. We can concatenate data types using the + operator.
input.rn
var name = input(\"Enter your name: \")\nprint(\"Hello, \" + name + \"!\") # Output: Hello, World!\n
It's easy to install Radon on your computer. Just go to the downloads page and download the latest version for your operating system. Then, follow the instructions below for your operating system. If you have any problems, please contact us and we'll help you out.
To install Radon on Windows, just download the installer from the downloads page and run it. Then, follow the instructions on the screen to install Radon on your computer.
After setup you need to manually configure the PATH environment variable. To do this, open the Control Panel and go to System and Security > System > Advanced system settings > Environment Variables. Then, select the PATH variable and click Edit. Add the path to the Radon bin directory to the end of the variable value. For example, if you installed Radon in C:\\Program Files (x86)\\Radon, you would add C:\\Program Files (x86)\\Radon to the end of the variable value. Then, click OK to save the changes.
Quick tip: You can also set the PATH variable from the command line. Just open a command prompt and type the following command:
Loops are used to execute a block of code multiple times. The block of code will be executed until the condition is true. This help us to reduce the code and execute the same block of code multiple times.
With continue we can skip the current iteration and move to the next iteration.
For loop example:
for i=0 to 5 {\n if i == 3 {\n continue\n }\n print(i)\n}\n
Output:
0\n1\n2\n4\n
While loop example:
i = 0\nwhile i < 5 {\n if i == 3 {\n nonlocal i += 1\n continue\n }\n print(i)\n nonlocal i += 1\n}\n
Output:
0\n1\n2\n4\n
That's all about loops in Radon.
"},{"location":"modules.html","title":"Modules","text":""},{"location":"modules.html#introduction-to-modules","title":"Introduction to Modules","text":"
Modules are a way to organize code in a way that is easy to reuse, test, and debug. Modules are also called packages, libraries, or frameworks. Modules are used to group related code together. For example, a module can be used to group code that is related to a specific task, such as sending an email. Modules are also used to group code that is related to a specific feature, such as a user interface.
"},{"location":"modules.html#creating-a-module","title":"Creating a Module","text":"
A module is created by creating a file with the .rn extension. The file name is the name of the module. The name should have to be in Pascal Case PascalCase. The module have to implement the same name class as the file name. The class name should have to be in Pascal Case PascalCase.
Hello.rn
class Hello {\n fun Hello() {\n print(\"Hello, World!\")\n }\n}\n
"},{"location":"modules.html#importing-a-module","title":"Importing a Module","text":"
A module is imported by using the include keyword. It is followed by the name of the module. The name of the module should have to be in Pascal Case PascalCase.
To get started with Radon language you can use the built-in REPL or just run the Radon file. Run a Radon file by typing radon -s <filename>.rn in the command line. For example, if you have a file named hello.rn you can run it by typing radon -s hello.rn in the command line.
The REPL is a command line interface that allows you to run Radon code interactively. To start the REPL, just type radon in the command line. You can then type Radon code and it will be executed immediately. To exit the REPL, just type exit() or press Ctrl + Z.
The first program that most people write in a new language is the \"Hello World\" program. This program simply prints the words \"Hello World\" to the screen. Here is the \"Hello World\" program in Radon:
HelloWorld.rn
print(\"Hello World\")\n
"},{"location":"standard-library.html","title":"Standard Library","text":""},{"location":"standard-library.html#list-of-standard-libraries","title":"List of Standard Libraries","text":"
We are excited to announce the launch Radon - a new open source programming language for the modern world. The language is designed to be simple, fast, and safe while incorporating modern language features such as type inference, pattern matching, and more. A key goal of the language is to be easy to learn and use, while still being powerful enough to build complex applications. It is also designed to be easy to embed in other applications, and to be used as a scripting language. The language is currently in the early stages of development, and we are looking for contributors to help us build the language.
"},{"location":"blog/hello-world.html#about-the-author","title":"About the author","text":"
Md. Almas Ali is a software engineer and a programming language enthusiast. He is the creator of the Radon programming language. He has a lot of projects in his GitHub profile. Checkout his GitHub profile for more information.
"}]}
\ No newline at end of file
+{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"index.html","title":"The Radon Programming Language","text":"Radon is a programming language that is designed to be easy to learn and use.
Radon is a programming language that is designed to be easy to learn and use. It is a high-level language intended to be used for general purpose programming. It is designed to be easy to learn and use, while still being powerful enough to be used for most tasks.
Some of the features of Radon include:
A simple syntax that is easy to learn and use
Dynamic typing so that you don't have to worry about types
Powerful standard library that makes it easy to do common tasks (Development)
Easy to use package manager that makes it easy to install packages (Future feature)
Functional programming support
Object-oriented programming support (Development)
Easy to use concurrency support (Future feature)
Easy to use GUI library (Future feature)
Easy to use web development library (Future feature)
# This is a Radon test file for the Radon Programming Language.\n\nclass Network {\n fun __constructor__(username, password) {\n this.username = username\n this.password = password\n }\n\n fun login() {\n if this.username == \"radon\" {\n if this.password == \"password\" {\n print(\"Log in successful\")\n }\n } else {\n print(\"Invalid credentials\")\n }\n }\n}\n\nusername = input(\"Enter you username: \")\npassword = input(\"Enter your password: \")\n\nnetwork = Network(username, password)\nnetwork.login()\n
"},{"location":"built-in-functions.html","title":"Built-in Functions","text":""},{"location":"built-in-functions.html#types-of-built-in-functions","title":"Types of built-in functions","text":"
Built-in functions are the functions that are built into the language. They are used to perform common tasks. In Radon, there are a list of built-in functions that are available to use.
arr_push(array, item) - adds an item to the end of the array.
arr_pop(array, index) - removes an item from the end of the array.
arr_append(array, item) - adds an item to the end of the array.
arr_extend(array1, array2) - adds all the items of an array to the end of the array.
arr_find(array, index) - returns the item at the specified index.
arr_slice(array, start, end) - returns the items from the specified start index to the specified end index.
"},{"location":"classes.html","title":"Classes and Objects","text":""},{"location":"classes.html#object-oriented-programming","title":"Object Oriented Programming","text":"
Object Oriented Programming (OOP) is a programming paradigm that uses objects and their interactions to design and program applications. It is based on the concept of objects rather than just functions and procedures. These objects are organized into classes, which allow individual objects to be grouped together. Most modern programming languages including Java, C/C++, and Python are object-oriented languages, and many older programming languages now have object-oriented versions.
In Radon, we also have support for OOP. We can create classes and objects. We can also create methods and fields.
Let's start by creating a class. We can create a class using the class keyword. It is followed by the name of the class and the body of the class. The body of the class is enclosed in curly braces.
Now that we have created a class, we can create an object. We can create an object by simply calling the class like as a function. It is followed by the name of the class and the arguments in parentheses. The arguments are optional.
Fields are the variables that are declared inside a class. They are used to store data. They are also called instance variables because they are unique to each instance of the class. They are declared using the var keyword. It is followed by the name of the field and the type of the field. The type of the field is optional.
Constructors are special methods that are used to initialize the fields of a class. They are called when an object is created. They are declared using the fun keyword. It is followed by the name (class name) of the constructor and the parameters in parentheses. The parameters are optional.
constructors.rn
class Person {\n fun Person(name, age) {\n this.name = name\n this.age = age\n }\n}\n\nperson = Person(\"John\", 20)\n
Methods are the functions that are declared inside a class. They are used to define the behavior of the class. They are declared using the fun keyword. It is followed by the name of the method, the parameters in parentheses, and the return type. The parameters and the return type are optional.
methods.rn
class Person {\n fun Person(name, age) {\n this.name = name\n this.age = age\n }\n\n fun sayHello() {\n print(\"Hello, \" + this.name + \"!\")\n }\n}\n\nperson = Person(\"John\", 20)\nperson.sayHello() # Output: Hello, John!\n
"},{"location":"contribution.html","title":"Contribution","text":""},{"location":"contribution.html#how-to-contribute","title":"How to contribute","text":"
We need contributors to help us build the language. If you are interested, please make contributions to the radon-project/radon repository.
Steps to contribute:
Fork the repository.
Clone the repository.
Create a new branch.
Make changes.
Commit changes.
Push to the branch.
Create a pull request.
Before making a pull request create an issue and discuss the changes you want to make. If you have any questions, feel free to ask in the issues section.
Conditional statements are used to execute code based on a condition. In Rain, the if statement is used to execute code if a condition is true. The else statement is used to execute code if the condition is false. The elif statement is used to execute code if the condition is false and another condition is true. The else statement is optional.
conditional-statements.rn
if true {\n print(\"true\")\n\n} else {\n print(\"false\")\n}\n
Arrays are declared using the [] syntax. The type of the array is the type of the elements it contains.
arrays.rn
a = [1, 2, 3]; // a is an array of ints\nb = [1.0, 2.0, 3.0]; // b is an array of floats\nc = [\"a\", \"b\", \"c\"]; // c is an array of strings\n\n// Arrays can be nested\nd = [\n [1, 2],\n [3, 4],\n]; // d is an array of arrays of ints\n\n// Arrays can be empty\ne = []; // e is an empty array of unknown type\n
Objects are declared using the {} syntax. The type of the object is the type of the fields it contains.
objects.rn
// a is an object with fields x and y of type int\na = { x: 1, y: 2 };\n// b is an object with fields x and y of type float\nb = { x: 1.0, y: 2.0 };\n// c is an object with fields x and y of type string\nc = { x: \"a\", y: \"b\" };\n\n// Objects can be nested\n// d is an object with fields x and w of type object\nd = { x: { y: 1, z: 2 }, w: { y: 3, z: 4 } };\n\n// Objects can be empty\n// e is an empty object of unknown type\ne = {};\n
To handle exceptions, we use the try and catch blocks. The try block contains the code that may throw an exception. The catch block contains the code that handles the exception.
exceptions.rn
try {\n // code that may throw an exception\n a = 1 / 0\n} catch as err {\n // code that handles the exception\n print(\"Exception caught: \" + err)\n}\n
Output:
Exception caught: Division by zero\n
Don't forget to use the as keyword to assign the exception to a variable. The variable can be used to get the exception message. If you don't want to use the exception message, you can omit the variable.
exceptions.rn
try {\n // code that may throw an exception\n a = 1 / 0\n} catch as _ {\n // code that handles the exception\n print(\"Exception caught\")\n}\n
To raise an exception, we use the raise keyword followed by the exception type and the message. We have builtin exceptions in radiation module. We can use them to raise exceptions.
When the exception is raised, the program stops executing and the exception is propagated up the call stack. The exception can be caught by a try block. If the exception is not caught, the program stops executing and the exception is printed to the console.
File handling is an essential part of any programming language. Radon provides a simple way to read and write files. In this section, we will learn how to read and write files in Radon.
When opening a file, we can specify the mode in which we want to open the file.
The modes are:
r: Read mode. Opens the file for reading. The file must exist.
w: Write mode. Opens the file for writing. If the file does not exist, it creates a new file. If the file exists, it truncates the file.
a: Append mode. Opens the file for writing. If the file does not exist, it creates a new file. If the file exists, it appends the content to the file.
r+: Read and write mode. Opens the file for reading and writing. The file must exist.
w+: Write and read mode. Opens the file for reading and writing. If the file does not exist, it creates a new file. If the file exists, it truncates the file.
a+: Append and read mode. Opens the file for reading and writing. If the file does not exist, it creates a new file. If the file exists, it appends the content to the file.
By default, the file is opened in read mode.
"},{"location":"file-handling.html#reading-from-a-file","title":"Reading from a file","text":"
To manipulate files in Radon, we use built-in File class. We can create a new instance of File class by passing the file path to the constructor. We can then use the read method to read the contents of the file.
"},{"location":"file-handling.html#closing-a-file","title":"Closing a file","text":"
After reading or writing to a file, it is important to close the file. We can use the close method to close the file.
file-handling.rn
file = File(\"file.txt\")\n# code that reads or writes to the file\nfile.close()\n
Check the file is closed or not using the is_closed method.
file-handling.rn
file.is_closed()\n
That's it! You now know how to read and write files in Radon.
"},{"location":"functions.html","title":"Functions","text":""},{"location":"functions.html#types-of-functions","title":"Types of functions","text":"
Functions are the building blocks of a task. They are used to define the behavior of the program. In Radon, we declare functions using the fun keyword. It is followed by the name of the function, the parameters, and the return type. The body of the function is enclosed in curly braces.
Function parameters are the names listed in the function definition. They are used to pass values into the function. The parameters are separated by commas. The parameters are optional.
We can also leave out the parentheses if there are no parameters.
function_parameters.rn
fun say_hello(name) {\n print(\"Hello, \" + name + \"!\")\n}\n\nsay_hello(\"World\") # Output: Hello, World!\n
Default parameters are used to assign a default value to a parameter. If the parameter is not passed, the default value is used.
default_parameters.rn
fun new_user(name=\"Guest\") {\n print(\"Hello, \" + name + \"!\")\n}\n\nnew_user() # Output: Hello, Guest!\nnew_user(\"World\") # Output: Hello, World!\n
"},{"location":"input-output.html","title":"Input Output","text":""},{"location":"input-output.html#printing-to-the-console","title":"Printing to the console","text":"
In Radon, we can print to the console using the print function. It is followed by the argument in parentheses. The argument are mandatory. It takes only one argument. We can concatenate data types using the + operator.
"},{"location":"input-output.html#input-from-the-console","title":"Input from the console","text":"
In Radon, we can take input from the console using the input function. It is followed by the argument in parentheses. The argument are mandatory. It takes only one argument. We can concatenate data types using the + operator.
input.rn
name = input(\"Enter your name: \")\nprint(\"Hello, \" + name + \"!\") # Output: Hello, World!\n
It's easy to install Radon on your computer. Just go to the downloads page and download the latest version for your operating system. Then, follow the instructions below for your operating system. If you have any problems, please contact us and we'll help you out.
To install Radon on Windows, just download the installer from the downloads page and run it. Then, follow the instructions on the screen to install Radon on your computer.
After setup you need to manually configure the PATH environment variable. To do this, open the Control Panel and go to System and Security > System > Advanced system settings > Environment Variables. Then, select the PATH variable and click Edit. Add the path to the Radon bin directory to the end of the variable value. For example, if you installed Radon in C:\\Program Files (x86)\\Radon, you would add C:\\Program Files (x86)\\Radon to the end of the variable value. Then, click OK to save the changes.
Quick tip: You can also set the PATH variable from the command line. Just open a command prompt and type the following command:
Loops are used to execute a block of code multiple times. The block of code will be executed until the condition is true. This help us to reduce the code and execute the same block of code multiple times.
With continue we can skip the current iteration and move to the next iteration.
For loop example:
for i=0 to 5 {\n if i == 3 {\n continue\n }\n print(i)\n}\n
Output:
0\n1\n2\n4\n
While loop example:
i = 0\nwhile i < 5 {\n if i == 3 {\n nonlocal i += 1\n continue\n }\n print(i)\n nonlocal i += 1\n}\n
Output:
0\n1\n2\n4\n
That's all about loops in Radon.
"},{"location":"modules.html","title":"Modules","text":""},{"location":"modules.html#introduction-to-modules","title":"Introduction to Modules","text":"
Modules are a way to organize code in a way that is easy to reuse, test, and debug. Modules are also called packages, libraries, or frameworks. Modules are used to group related code together. For example, a module can be used to group code that is related to a specific task, such as sending an email. Modules are also used to group code that is related to a specific feature, such as a user interface.
"},{"location":"modules.html#creating-a-module","title":"Creating a Module","text":"
A module is created by creating a file with the .rn extension. The file name is the name of the module. The name should have to be in Pascal Case PascalCase. The module have to implement the same name class as the file name. The class name should have to be in Pascal Case PascalCase.
Hello.rn
class Hello {\n fun Hello() {\n print(\"Hello, World!\")\n }\n}\n
"},{"location":"modules.html#importing-a-module","title":"Importing a Module","text":"
A module is imported by using the include keyword. It is followed by the name of the module. The name of the module should have to be in Pascal Case PascalCase.
To get started with Radon language you can use the built-in REPL or just run the Radon file. Run a Radon file by typing radon -s <filename>.rn in the command line. For example, if you have a file named hello.rn you can run it by typing radon -s hello.rn in the command line.
The REPL is a command line interface that allows you to run Radon code interactively. To start the REPL, just type radon in the command line. You can then type Radon code and it will be executed immediately. To exit the REPL, just type exit() or press Ctrl + Z.
The first program that most people write in a new language is the \"Hello World\" program. This program simply prints the words \"Hello World\" to the screen. Here is the \"Hello World\" program in Radon:
HelloWorld.rn
print(\"Hello World\")\n
"},{"location":"standard-library.html","title":"Standard Library","text":""},{"location":"standard-library.html#list-of-standard-libraries","title":"List of Standard Libraries","text":"
We are excited to announce the launch Radon - a new open source programming language for the modern world. The language is designed to be simple, fast, and safe while incorporating modern language features such as type inference, pattern matching, and more. A key goal of the language is to be easy to learn and use, while still being powerful enough to build complex applications. It is also designed to be easy to embed in other applications, and to be used as a scripting language. The language is currently in the early stages of development, and we are looking for contributors to help us build the language.
"},{"location":"blog/hello-world.html#about-the-author","title":"About the author","text":"
Md. Almas Ali is a software engineer and a programming language enthusiast. He is the creator of the Radon programming language. He has a lot of projects in his GitHub profile. Checkout his GitHub profile for more information.