if (FALSE) {
# Rust code without return value, called only for its side effects
rust_eval(
code = 'rprintln!("hello from Rust!");'
)
# Rust code with return value
rust_eval(
code = "
let x = 5;
let y = 7;
let z = x * y;
z // return to R; rust_eval() takes care of type conversion code
"
)
}
Run the code above in your browser using DataLab