右侧的多个OR语句

时间:2018-07-29 15:44:35

标签: elm

我对我在这里想念的东西感到困惑。我是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. 

1 个答案:

答案 0 :(得分:5)

Elm对缩进很敏感。

grid子句中的foundlet的声明必须具有相同的缩进,但是found的缩进空间比grid多。

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