elm - 右侧有多个 OR 语句
问题描述
我对我在这里缺少的东西感到困惑。我是 Elm 的新手,但我不明白这怎么可能是错误的:
move : List Char -> Char -> Int
move board symbol =
let
grid =
fromList board
found =
((get 0 grid == symbol) && (get 1 grid == symbol) && (get 2 grid == symbol))
|| ((get 4 grid == symbol) && (get 4 grid == symbol) && (get 5 grid == symbol))
in
if found then
1
else
0
错误:
The = operator is reserved for defining variables. Maybe you want == instead? Or
maybe you are defining a variable, but there is whitespace before it?
14| found =
^
Maybe <http://elm-lang.org/docs/syntax> can help you figure it out.
Detected errors in 1 module.
解决方案
榆树对缩进很敏感。
grid
子句中和found
的声明let
必须具有相同的缩进,但found
缩进比 . 多一个空格grid
。
尝试删除一个空格,使这两个声明对齐。
推荐阅读
- ios - Passing an ObservableObject model through another ObObject?
- mysql - MySQL 工作台不会将数据库发送到 localhost/phpmyadmin
- qt - Qt Signal“输入”未连接到插槽
- shell - Shell 模式匹配 - 2 种文件类型,1 种豁免文件类型
- bash - 使用 SED 命令替换包含斜杠的字符串
- angular - Angular - 多于 1 条路线如何组织
- python - 如何通过与 Raspberry Pi 的串行通信向设备提交一封信并接收回信息?
- database - 如何创建显示来自多列的唯一记录的报告
- javascript - 将我的 HTML/CSS/JS 文件上传到 cPanel 后,我可以在 HTML/CSS 正常工作的情况下查看我的网站,但我的 .js 文件中的 JavaScript 无法正常工作
- sql - SQL - 在 SQL 中实现类似嵌套循环