I\'m trying to write a Tic Tac Toe game in Rust, but this function for changing a field doesn\'t work and I don\'t know what\'s wrong with it:
fn change_fie
The reason is given to you in the notes:
note: slice indices are of type `usize`
slice indices are of type `usize` or ranges of `usize`
You need to cast the i32
value to usize
, for example:
table[(field - 1) as usize]
Alternatively, consider using usize
as the type of the field
variable, if it makes sense in your application.