Same result different code

Hi there,
I’m new to coding and these tutorials are helpful.

But when I solved the exercise in the 4th chapter, 13th video (4th ex.) I got in my eyes a very different code for the same work.
I mean, maybe I did something that doesn’t make sense… but it still works.

How can I take the most out of it, also going forward?



If it works that’s fine. Especially from a learning person.
Moreover every code has a personal style. I see it in the team i belong to.

When things get a bit more serious you may start worrying about other concerns.
Myself, I am still far away from what I mean.
Some people are into comparing different methods of doing the same thing to be more efficient in term of resources, time, a code takes.

Being curious is good, but over-worrying about it is not.

Take your time with such concerns. They will come to you sooner or later.


P.S. : To answer your question you shall do the exercises the most possible on your own. After a while if you struggle you can seek any help.
When you have a working solution, you can compare. I can tell you that on the internet you may have solutions that are not so good that you may think, even on a platform such as stack overflow or even here.
People are trying to help but they do not really know.
I remember having a validation problem with ASP .NET and asked on SO. The answer I got was to disable validation which is a but no no to me. This helps the database ensure the integrity of my model when doing what I was told was basically making the DB weak.
I actually found my own solution afterwards. Maybe far from perfect but nothing is. You have to make technical choices all the time.

Thank you very mutch.
I think I get what you’re saying, so I’ll try to keep that in mind.

With kind regards