仓颉编程报错
对不可变变量赋值,就会报错
[31merror[0m: cannot assign to immutable value
[36m==>[0m a.cj:8:20:
[36m| [0m
[36m8[0m [36m| [0m case 77 => a = 'a77'[0m
[36m| [0m [31m^^^^^^^^^ [0m
[36m| [0m
[34mnote[0m: variable 'a' is immutable
[36m==>[0m a.cj:5:9:
[36m| [0m
[36m5[0m [36m| [0m let a = 'Hello World!'//不可变量[0m
[36m| [0m [34m^ [0m
[36m| [0m
[31merror[0m: cannot assign to immutable value
[36m==>[0m a.cj:10:20:
[36m| [0m
[36m10[0m [36m| [0m case 78 => a = 'a78'[0m
[36m| [0m [31m^^^^^^^^^ [0m
[36m| [0m
[34mnote[0m: variable 'a' is immutable
[36m==>[0m a.cj:5:9:
[36m| [0m
[36m5[0m [36m| [0m let a = 'Hello World!'//不可变量[0m
[36m| [0m [34m^ [0m
[36m| [0m
[31merror[0m: cannot assign to immutable value
[36m==>[0m a.cj:12:19:
[36m| [0m
[36m12[0m [36m| [0m case _ => a= ''[0m
[36m| [0m [31m^^^^^ [0m
[36m| [0m
[34mnote[0m: variable 'a' is immutable
[36m==>[0m a.cj:5:9:
[36m| [0m
[36m5[0m [36m| [0m let a = 'Hello World!'//不可变量[0m
[36m| [0m [34m^ [0m
[36m| [0m
3 errors generated, 3 errors printed.