1
0
This commit is contained in:
Jeff 2024-08-20 15:55:35 -04:00
parent 2eff51815a
commit 80bf09d807
4 changed files with 11 additions and 16 deletions

View File

@ -157,13 +157,8 @@ impl<'src> Parser<'src> {
end end
} else { } else {
return Err(ParseError::ExpectedToken { value.position().1
expected: TokenKind::Semicolon,
actual: self.current_token.to_owned(),
position: self.current_position,
});
}; };
let r#let = if is_mutable { let r#let = if is_mutable {
LetStatement::LetMut { identifier, value } LetStatement::LetMut { identifier, value }
} else { } else {

View File

@ -1,8 +1,8 @@
let mut count = 1; let mut count = 1
while count <= 15 { while count <= 15 {
let divides_by_3 = count % 3 == 0; let divides_by_3 = count % 3 == 0
let divides_by_5 = count % 5 == 0; let divides_by_5 = count % 5 == 0
let output = if divides_by_3 && divides_by_5 { let output = if divides_by_3 && divides_by_5 {
"fizzbuzz" "fizzbuzz"
@ -12,7 +12,7 @@ while count <= 15 {
"buzz" "buzz"
} else { } else {
count.to_string() count.to_string()
}; }
write_line(output) write_line(output)

View File

@ -1,12 +1,12 @@
io.write_line("Guess the number.") write_line("Guess the number.")
secret_number = int.random_range(0..100) let secret_number = random(0..100);
loop { loop {
io.write_line("Input your guess.") write_line("Input your guess.")
input = io.read_line() let input = io.read_line();
guess = int.parse(input) let guess = int.parse(input);
if guess < secret_number { if guess < secret_number {
io.write_line("Too low!") io.write_line("Too low!")

View File

@ -1,6 +1,6 @@
write_line("Hello, world!") write_line("Hello, world!")
write_line("Enter your name...") write_line("Enter your name...")
let name = read_line(); let name = read_line()
write_line("Hello " + name + "!") write_line("Hello " + name + "!")