Hello World
Let's write your first Rui program! This is a tradition in programming - your first program should print "Hello, World!" to the console.
Creating Your First Program
Create a new file called hello.rui:
write("Hello, World!")That's it! This simple program uses Rui's write function to print text to the console.
Running Your Program
To run your Rui program, use the rui command followed by the filename:
rui hello.ruiYou should see the output:
Hello, World!Understanding the Code
Let's break down what happened:
write()is a built-in function in Rui that prints text to the console- The text inside the parentheses
"Hello, World!"is a string literal - The semicolon at the end is optional in Rui (but recommended for clarity)
Try It Yourself
Modify the program to print your name:
write("Hello, my name is [Your Name]!")Run it again and see your personalized message!
Next Steps
Now that you've written your first Rui program, you're ready to learn about Variables and how to store and manipulate data.