Fix add_num_to_string not printing 10

This commit is contained in:
Sofia 2025-07-23 21:18:38 +03:00
parent 14537743ed
commit 0d3abe8e42
2 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import std::add_num_to_str;
import std::free_string;
fn main() -> u32 {
for i in 0 .. 5 {
for i in 0 .. 15 {
let mut text = new_string();
add_num_to_str(&mut text, i);
print(&text);

View File

@ -93,7 +93,7 @@ fn str_length(string: *char, position: u32) -> u32 {
}
pub fn add_num_to_str(string: &mut String, num: u64) {
if num > 10 {
if num >= 10 {
add_num_to_str(string, num / 10)
}
let rem = num % 10;