Skip to content

Inconsistent use of curly braces #834

Closed as not planned
Closed as not planned
@wolfseifert

Description

@wolfseifert

In a single statement function

a: () -> int =
  13;

b: () -> int = {
  return 42;
}

and in a for-loop with only one statement

v: vector = (1, 2, 3, 4, 5);
for v do (i) {
  print("(i)$ ");
}
println();
for v do (i)
  print("(i)$ ");
println();

curly braces are optional.

But for if

b:= true;
if b {
  println("b is true");
} else {
  println("b is false");
}

and while

v := :vector = (1, 2, 3, 4, 5);
i := 0U;
while i < v.size() next i++ {
  print("(v[i])$ ");
}
println();

curly braces are mandatory. This seems inconsistent to me. Or do I miss something?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions