【问题标题】:If condition must be associated with curly braces?如果条件必须与花括号相关联?
【发布时间】:2019-08-18 08:15:52
【问题描述】:

在芭蕾舞演员中,如果条件相关的语句应该与花括号相关联。即使存在与 if 条件关联的单个语句,这也是必需的。这是正常的还是与芭蕾舞演员语言相关的约定?

var a = 10;
if (a > 10) io:println("Value is high"); // This shows an error with the IDE

if(a > 10){
   io:println("Value is high"); // This is the correct format recognized as 
   the correct way
}

在第一种方法中,它表示输入不匹配。

【问题讨论】:

    标签: ballerina


    【解决方案1】:

    是的,大括号是强制性的。参考https://ballerina.io/learn/by-example/if-else.html

    【讨论】:

    • 感谢您的帮助。我会参考资源。
    猜你喜欢
    • 2019-07-11
    • 1970-01-01
    • 2020-02-10
    • 1970-01-01
    • 2012-01-18
    • 1970-01-01
    • 2021-11-10
    • 2012-03-31
    • 1970-01-01
    相关资源
    最近更新 更多