Final comma in structure definition #2368
Answered
by
Kelimion
programandala-net
asked this question in
Q&A
-
A comma is mandatory after the last struct field when the ending bracket is on a new line. But what is the rationale? Or is it an oversight? // ok:
My_Struct :: struct { x : int, y : int }
// ok:
My_Struct :: struct { x : int, y : int, }
// ok:
My_Struct :: struct {
x : int,
y : int,
}
// Syntax Error: Expected a comma, got a newline:
My_Struct :: struct {
x : int,
y : int
}
// Syntax Error: Expected a comma, got a newline:
My_Struct :: struct { x : int, y : int
} |
Beta Was this translation helpful? Give feedback.
Answered by
Kelimion
Mar 8, 2023
Replies: 1 comment 1 reply
-
Now try rearranging or adding some fields and see what's more convenient. There's the rationale. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Kelimion
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now try rearranging or adding some fields and see what's more convenient. There's the rationale.