Rust:cannot assign twice to immutable variable `x`错误解决方法
在rust语言中,变量默认情况下是不允许被改变的,当你试图修改一个不可变变量时,将造成error[E0384]: cannot assign twice to immutable variable `x`这样的错误;
你可以在变量名前加上关键字mut
使其变得可变;
在rust语言中,变量默认情况下是不允许被改变的,当你试图修改一个不可变变量时,将造成error[E0384]: cannot assign twice to immutable variable `x`这样的错误;
你可以在变量名前加上关键字mut
使其变得可变;
原创内容,如需转载,请注明出处;
本文地址: https://www.perfcode.com/p/cannot-assign-twice-to-immutable-variable.html
C语言、Python、Rust一对一辅导、答疑;