Is @[params] obsolete? #23821
-
I tried this example without the Example: https://play.vlang.io/p/c9f0073718 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Read the note at the bottom of that section of the docs: [!NOTE] Note the @[params] tag is used to tell V, that the trailing struct parameter can be omitted entirely, so that you can write button := new_button(). Without it, you have to specify at least one of the field names, even if it has its default value, otherwise the compiler will produce this error message, when you call the function with no parameters:
|
Beta Was this translation helpful? Give feedback.
Read the note at the bottom of that section of the docs:
[!NOTE] Note the @[params] tag is used to tell V, that the trailing struct parameter can be omitted entirely, so that you can write button := new_button(). Without it, you have to specify at least one of the field names, even if it has its default value, otherwise the compiler will produce this error message, when you call the function with no parameters:
error: expected 1 arguments, but got 0.