-1
當我嘗試使用rustc main.rs
編譯這段代碼:「沒有規矩預期令牌」中寫'let`語句時,宏
macro_rules! getPI {
let pi = 3.141592;
println!("Pi is roughly 3.142 \n {0}", pi);
}
fn main() {
print!(getPI);
}
它給了我一個錯誤:
error: no rules expected the token `pi`
--> src/main.rs:2:9
|
2 | let pi = 3.141592;
| ^^
我對編程非常陌生,我希望有人有解決方案。
爲什麼你想要這是一個宏? – sepp2k
@ sepp2k周圍測試。 –