Hey awesome people! How are you doing today? Today is the Day 13 of #30DaysOfCode and as part of the daily challenge, I learnt how to use defer, panic, recover and Pointers is Golang. So, let's talk about them in detail.
Loops in Go
In Golang, we only have a single loop which can be implemented in more than one ways. The for loop has there part. The first one being the init statement. It is the part where we initialize our iterator variable. It is executed before the first iteration. The second part is the condition expression. It is the part where we put our conditional logic. It is executed before every iteration. If the condition is true then the iteration will be done again and if the condition results false then the loop will end. The third part is the post statement. It is the part where we increment or decrement our iterator variable. This part is executed at the end of every iteration. After the post part, the condition statement evaluates again if the value of the conditional statement is false, then the loop ends. This is a very brief introduction to Loops in Go. And I will write a detailed post on Loops In Golang after the challenge is complete.
Here are the two way to write a for loop in Go.
Defer, Panic and recover are the three things in Go that need a separate blog post for themselves. We can't really discuss these three topics in 10 lines in a blog post. One thing I would like to point out though is that these three have everything to do with error handling in Go. And we will discuss these in great detail in a separate post.
Now let's talk a bit about Pointers in Go. If you have been following me from Day 1 then you would know that I have written about pointers in the near past. Actually, I have written about it in two separate posts. I am linking those two post here. Also, when the #30DaysOfCode challenge is complete, I will be writing about the fundamentals of Go Programming Language. So make sure that you follow me for that.
Pointers and Maps In Go | Day 4 of #30DaysOfCode
Pointers and new() In Go | Day 6 of #30DaysOfCode
Alright! That's enough for today. It was a lot to learn for me and hopefully, I will continue to enjoy these long working days.
Connect With Me:
Youtube: ShubhamSauravYT.
Twitter: @hiShubhamSaurav
Instagram: @hiShubhamSaurav
Facebook: @hiShubhamSaurav
Top comments (0)