notes[x]
行で計算された127 f64
の値の配列が必要です。Rustの配列に値を代入すると、エラーが発生します: '予想されるf64、使用が見つかりました'
let mut notes: [f64; 127];
let a = 440;
for x in 0..127 {
notes[x] = (a/32) * (2^((x - 9)/12));
}
これはエラーです:
error[E0308]: mismatched types
--> src/main.rs:5:20
|
5 | notes[x] = (a/32) * (2^((x - 9)/12));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected f64, found usize
「^」は「pow」を意味します。 – ildjarn
ああ、私はそれを逃した。私はこれを含めるでしょう。 – ljedrz
ありがとうございました。錆はまだJavaの背景から移行するのは難しい、私にとっては非常に新しいです。 – VikingPingvin