rhai/examples/hello.rs
2020-03-24 09:49:08 +08:00

12 lines
231 B
Rust

use rhai::{Engine, EvalAltResult, INT};
fn main() -> Result<(), EvalAltResult> {
let mut engine = Engine::new();
let result = engine.eval::<INT>("40 + 2")?;
println!("Answer: {}", result); // prints 42
Ok(())
}