Getting Started with Bytewen
Welcome to Bytewen! This guide will walk you through the basics of setting up Bytewen, understanding its core features, and writing your first program.
1. Introduction to Bytewen
Bytewen is a minimalistic programming language designed for simplicity and efficiency. It combines the ease of writing basic scripts with enough power for more advanced tasks. Bytewen's intuitive syntax and clean design make it ideal for both beginners and experienced developers.
2. Setting Up Bytewen
There are several ways you can use Bytewen, but the simplest is to use the built-in online Bytewen interpreter.
- Visit our Bytewen Demo page to start coding right away.
- If you prefer to run Bytewen locally, follow these steps:
- Download the Bytewen interpreter from the GitHub repository.
- Once downloaded, run the interpreter with your Bytewen scripts using the command line:
bytewen myscript.bw
3. Bytewen Syntax Overview
Bytewen is designed with a minimalistic syntax to help you write clean and readable code. Here’s an overview of the core concepts:
Variables
In Bytewen, variables are assigned using the = operator:
x = 10
name = "Alice"
Output
To print text or variables to the screen, use the output statement:
output "Hello, World!"
output x
Possibilities (Functions)
In Bytewen, functions are called "possibilities." You can define a possibility and call it by name:
possibility greet {
output "Hello!"
}
call greet
Conditionals
Conditional statements help you control the flow of your program:
if (x > 5) {
output "x is greater than 5"
} else {
output "x is less than or equal to 5"
}
Loops
Bytewen allows you to repeat blocks of code using the repeat statement:
repeat 3 {
output "This will print three times"
}
4. Writing Your First Bytewen Program
Now that you're familiar with the syntax, let's write a simple program that performs some calculations and prints the result:
x = 5
y = 10
possibility add(x, y) {
output "The sum is: " + (x + y)
}
call add(x, y)
output "Finished the calculation."
This script defines two variables, x and y, and a possibility called add that outputs their sum. Finally, it prints a message indicating that the program is finished.
5. More Features of Bytewen
Bytewen also supports a range of advanced features, such as:
Random Number Generation
Generate a random number between a given range:
randomNumber(1, 100)
Date and Time
Output the current time:
currentTime
Input
Accept user input and store it in a variable:
input name
output "Hello, " + name
6. Next Steps
Now that you have a basic understanding of Bytewen, it’s time to start exploring the language more deeply. Head over to the Documentation for more detailed information on Bytewen’s features, or try writing your own programs in the Bytewen Demo.