初級 › E0061: this function takes N arguments but M were supplied の原因と直し方 › パターン1
E0061: this function takes N arguments but M were supplied の原因と直し方
関数が定義している数と異なる数の引数を渡すと、コンパイル時にE0061エラーになります。
1 fn add(a: i32, b: i32) -> i32 { 2 a + b 3 } 4 5 fn main() { 6 println!("{}", add(_______)); ^ 7 }
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
空欄を埋めて実行を通す
addは引数を2個受け取ると定義されています。3個渡すと個数が合わずコンパイルエラーになります。
次の問題