Struct implementation

if the structure is ----->

type extra struct{
simple struct{
x int
y struct{
x int
}
}
}

then how to initializing structure extra .

I am nut sure if I understand you correctly, can you therefore provide a bit more code which shows what you want to achieve?

Either use playground or use markdown to format your code and post it here.

I assume this is what you are wanting: https://play.golang.org/p/I6bxRo0r9oN

my basic doubt is how can we initialize the anonymous struct

By either not making it anonymous or repeating it all the time.

Can’t provide an example as I’m on my mobile.

PS: I strictly prefer to not use anonymous structure as they massively increase complexity without giving much of benefits.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.