Fix for-loops

This commit is contained in:
Sofia 2025-07-23 21:16:57 +03:00
parent 5831b06af5
commit 14537743ed
2 changed files with 9 additions and 5 deletions

View File

@ -1,12 +1,16 @@
// Arithmetic, function calls and imports!
import std::print;
import std::from_str;
import std::new_string;
import std::add_num_to_str;
import std::free_string;
fn main() -> u32 {
let text = from_str("hello");
for i in 0 .. 10 {
print(&text)
for i in 0 .. 5 {
let mut text = new_string();
add_num_to_str(&mut text, i);
print(&text);
free_string(&mut text);
}
let mut num = 0;

View File

@ -186,7 +186,7 @@ impl ast::Block {
counter_range.as_meta(module_id),
);
let mut block = block.into_mir(module_id);
block.statements.insert(0, set_new);
block.statements.push(set_new);
(
StmtKind::While(WhileStatement {
condition: mir::Expression(