fubark / cyber

Fast and concurrent scripting.
https://cyberscript.dev
MIT License
1.16k stars 38 forks source link

Print without inserting a newline at the end? #42

Closed sts10 closed 1 year ago

sts10 commented 1 year ago

It might be nice to have the option for print not to insert a newline at the end.

For example, in Python, print takes an optional end-character, allowing user to overwrite the default newline:

print("hello, ", end='')
print("world")

In Go, we get a slightly different method:

fmt.Printf("hello, ")
fmt.Printf("world")

And similarly in Rust, a slightly different macro: print!("hello, ")

Maybe a bit niche for so young a language, but it can be handy when using loops.

fubark commented 1 year ago

You can achieve this with prints. It's not currently emulated in the playground though, I should take a look at that...

fubark commented 1 year ago

This should be working now in the playground.