首页 > 解决方案 > 右侧有多个 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. 

标签: elm

解决方案


榆树对缩进很敏感。

grid子句中和found的声明let必须具有相同的缩进,但found缩进比 . 多一个空格grid

尝试删除一个空格,使这两个声明对齐。


推荐阅读