In Go, how to write a multi-line statement?

后端 未结 2 1018
你的背包
你的背包 2021-01-01 09:46

In python, we use backslash to indicate that the current statement continues to next line

for example,

a = b + c + s \\
    + x + y

2条回答
  •  太阳男子
    2021-01-01 10:34

    Sure it is, just put an operator at the end, for example:

    a = b + c + s +
        x + y
    

    Also note that it's not possible to break the line before the operator. The following code is invalid:

    a = b + c + s
        + x + y
    

    The rule is described here and in the specification.

提交回复
热议问题