Browse Source

Fix examples

github-actions
Garrit Franke 3 years ago
parent
commit
0c10ed907d
  1. 2
      README.md
  2. 4
      docs/introduction/hello-world.md
  3. 2
      examples/fib.sb
  4. 2
      examples/greeter.sb
  5. 2
      examples/hello_world.sb
  6. 4
      examples/leapyear.sb

2
README.md

@ -19,7 +19,7 @@ The Sabre compiler emits JavaScript, until the language has matured sufficiently
fn main() {
let num = 10
return fib(num)
print(fib(num))
}
fn fib(n) {

4
docs/introduction/hello-world.md

@ -2,8 +2,6 @@
Now that you have installed Sabre, it is time to write our first program. This is a program that will simply print a string to the screen.
> **Note:** Sabre is still at a very early state of development. Currently, the only way to print something to stdout is by returning a value from the `main` function.
# Creating a project directory
Let's begin by setting up our development workspace. Sabre really doesn't care where you store the code, so feel free to choose a different directory, than the one in this example.
@ -23,7 +21,7 @@ Now open the main.sb file you just created and enter the following code:
```
fn main() {
return "Hello, world!"
print("Hello, world!")
}
```

2
examples/fib.sb

@ -1,6 +1,6 @@
fn main() {
let num = 10
return fib(num)
print(fib(num))
}
fn fib(n) {

2
examples/greeter.sb

@ -1,5 +1,5 @@
fn main() {
return greet("World")
print(greet("World"))
}
fn greet(name) {

2
examples/hello_world.sb

@ -1,3 +1,3 @@
fn main(n) {
return "Hello World"
print("Hello World")
}

4
examples/leapyear.sb

@ -10,8 +10,8 @@ fn main() {
let ly = divisibleBy4 && divisibleBy100
if ly || divisibleBy400 {
return "Leap year"
print("Leap year")
} else {
return "Not a leap year"
print("Not a leap year")
}
}
Loading…
Cancel
Save