sorry to answer you late.
i couldn't find the time to check your responses
first of all, thank you for the answers

Michael i changed your code a bit because there was an unnecessary recursion
if you wanna check it out
here is a new link for it
https://play.golang.org/p/4MSOb6OKvKY

Michael Ellis <michael.f.el...@gmail.com>, 3 Eyl 2021 Cum, 03:30 tarihinde
şunu yazdı:

> Here's one way. https://goplay.space/#5KzrUc0171N
>
> On Thursday, September 2, 2021 at 1:03:48 AM UTC-4 seank...@gmail.com
> wrote:
>
>> Try doing it recursively, passing in both the current parent id and
>> indentation level
>>
>> On Thursday, September 2, 2021 at 3:55:01 AM UTC+2 n.erde...@gmail.com
>> wrote:
>>
>>> i need some help with printing a slice of structs which there is a child
>>> - parent relation in the struct.
>>> *type* Emp *struct* {
>>>         id       int
>>>         name     string
>>>         parentID int
>>> }
>>> probably the best way to do it recursively but i couldnt manage to do
>>> https://play.golang.org/p/jHcbu3uBgOD
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/ae9b334a-67ab-4e5a-a1a6-a4e2a996a3ebn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/ae9b334a-67ab-4e5a-a1a6-a4e2a996a3ebn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAKju_cC_JMS2_YneNty9DtY8SHGtcvt_72og0n1Qk8wZj4PkUw%40mail.gmail.com.

Reply via email to