Vyzon is a modern programming language inspired by the elegance of Python, the flexibility of JavaScript, and the expressiveness of Ruby. It is designed with a primary focus on readability and simplicity while maintaining powerful functionality.
To use Vyzon locally, follow these steps:
-
Clone the repository to your local machine using Git:
git clone https://github.com/Amanot-001/Vyzon.git -
Change your current directory to the cloned repository:
cd Vyzon -
Create a new Vyzon file with your code in the main directory. Name the file with a .Vyzon extension, for example, yourfile.Vyzon.
-
To run your Vyzon code, execute the following command in your terminal:
node run.js
In Vyzon, variables are declared using the let keyword. By default, when you declare a variable using let, it is initialized with a value of 0. For example:
let a; // Variable 'a' is declared and initialized with the default value of 0
let b = 1; // Variable 'b' is declared and initialized with the value 1
let c = 'Hello, World!';
Vyzon supports various data types, including strings, numbers, true, false, and null, to represent a wide range of values.
For example:
let a = 'Hello, World!';
let b = 10;
let c = 10 + (10 * 3) + a;
let d = "Ok!";
let e = null;
let f = true;
let g = false;
In Vyzon, you can print to the console using the write() function.
Here are some examples:
let a = 'Anything';
write(a);
write("abc");
write("write anything: ", a);
Vyzon provides string manipulation capabilities:
.lengthProperty: To find the length of a string, use the .length property. For example:
let a = 'abcd';
write(a.length); // This will print the length of the string.
- String Indexing: You can access individual characters within a string using square brackets. For instance:
let a = 'abcd';
write(a[0]); // This will print the first character 'a'.
Vyzon supports conditional statements for decision-making in your code. You can use the if, elif, and else statements to execute different blocks of code based on specific conditions. Here's an example:
let x = 10;
if (x > 15) {
write("x is greater than 15");
} elif (x > 5) {
write("x is greater than 5 but not greater than 15");
} else {
write("x is not greater than 5");
}
Vyzon supports various loop types to suit your needs. You can use for, while, and do while loops to control the flow of your Vyzon programs by repeating code as needed.
write("Using the for loop:");
for (let i=0; i<10; i+=1) {
write("Current value of i: ", i);
}
write("Using the while loop:");
let j = 0;
while (j < 5) {
write("Current value of j: ", j);
j = j + 1;
}
write("Using the do-while loop:");
let k = 0;
do {
write("Current value of k: ", k);
k = k + 1;
} while (k < 5);
You can declare functions in Vyzon using the def keyword, followed by the function name and parameters enclosed in parentheses. The function body is defined in a block. To call a function, use its name followed by parentheses, passing any required arguments.
def greet(name) {
write("Hello, " + name + "!");
}
greet("Yash"); // Calls the greet function with "Alice" as an argument.
- Logical Operators:
- The logical operators are the same as in other programming languages. Ex:
&&,||,!
- The logical operators are the same as in other programming languages. Ex:
- Relational operators:
- The relational operators are the same as in other programming languages. Ex:
<, >, <=, >=, ==, !=
- The relational operators are the same as in other programming languages. Ex:
- Arithmetic operators:
- The arithmetic operators are the same as in other programming languages. Ex:
+, -, *, /, %, ^
- The arithmetic operators are the same as in other programming languages. Ex:
- Assignment operators:
- Assignment operators are the same as in other programming languages. Ex:
=, +=, -=, *=, /=
- Assignment operators are the same as in other programming languages. Ex:
- Every statement in Vyzon should end with a semicolon
(;)to indicate the termination of the statement. - Variable names in Vyzon should not start with a number.
- All functions in Vyzon should be declared above their function calls.