rust print i8
To print an i8
value in Rust, you can use the println!
macro. Here's an example:
fn main() {
let num: i8 = 42;
println!("{}", num);
}
This code declares a variable num
of type i8
and assigns it the value 42
. The println!
macro is then used to print the value of num
to the console. The {}
inside the println!
macro is a placeholder that gets replaced with the value of num
.
When you run this code, it will output 42
to the console.