Build with Bytes
Bytes is a growable byte buffer and moon's efficient string builder. Appending avoids the repeated whole-string copies caused by a long chain of + operations.
Byte values are checked to 0..=255. to_string() preserves the accumulated bytes; slice copies rather than exposing an alias.
use std.bytes
fn main() {
let buffer = bytes.new()
buffer.append_string("moon")
buffer.push(32)
buffer.append_string("1")
println(buffer.to_string())
}
Examples use the moon toolchain version shown beside each result.
Output & diagnostics
Expected: moon 1
Ctrl/⌘+Enter runs the current lesson.