Sometimes code may be like on:
enum Variants {
Variant1(String),
Variant2(String),
Variant3(String),
...
}
But, I am think this synax would better:
enum Variants(String) {
Variant1,
Variant2,
Variant3,
...
}
Sometimes code may be like on:
enum Variants {
Variant1(String),
Variant2(String),
Variant3(String),
...
}
But, I am think this synax would better:
enum Variants(String) {
Variant1,
Variant2,
Variant3,
...
}
That's a product type:
struct Variants(String, Variant);
enum Variant {
Variant1,
Variant2,
Variant3,
}
yes, can do something similar to this, but it needs 1 more line compared to my variant syntax
I don't think that complicating the language even more is worth just one line of code.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.