Rust program to print a message using write() function


Print a message using write() function

Rust Programming Language


Print a message using write() function


Problem


In this program, we will print a message using the write() function.


Input


// Rust program to print a message 
// using write() function

use std::io::Write;

fn main() {
   std::io::stdout().write(format!("Hello World").as_bytes()).unwrap();
}{codeBox}


Output


Hello World{codeBox}


Explanation


In the main() function, we printed the "Hello World" message using the write() function.



Post a Comment