Golang Tutorial #17 - Advanced Function Concepts & Function Closures

preview_player
Показать описание
This golang tutorial covers functions and function closures in the go programming language. Functions in go are their own data type, this allows them to be passed around, defined inside eachother and used as parameters or return types for functions.

◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python

◾◾◾◾◾◾

⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡

⭐ Tags ⭐
- Tech With Tim
- Golang Functions
- Function Closures Golang
- Golang Tutorial
- Functions Go
- Go Programming Tutorial

⭐ Hashtags ⭐
#GO # Golang
Рекомендации по теме
Комментарии
Автор

Main thing you are missing here is "Each closure is bound to its own sum variable".. For example inside the closure if you are incrementing sum.
Every time you call x
sum will increment for one. The state of sum is sort of saved after each call./

We can associate this with generators in python.
You could implement iterator using closures.

sanjeevsiva
Автор

I just found this video randomly and this is awesome dude. Most tutorials or courses don't go this in depth. The website I was studying just assumed we'd figure this stuff out on our own after teaching us the syntax of functions. The way you explain it helps me understand what's actually happening under the scenes and not "this is the syntax, this is what it does"

You make great tutorials.

yotubeaccoutsuperawesome
Автор

Coming from a Typescript background, you made it extremely easy to understand the type system also with this video, thanks for sharing!

mateoguevara
Автор

Great tutorials Tim! A helpful way to think about closures is that a closure is a function that "closes" over a value in its outer scope.

massouji
Автор

Thanks for these tutorials Tim, best ones I’ve seen along with your other programming tutorials.

md-wv
Автор

Thanks for every tutorial you taught for free....
You have a lot of fans....

morty
Автор

3:40 looks like the good old plain Javascript

opensourceradionics
Автор

would have been a little helpful to add a piece on passing by value or by reference and returning. unsure whether the closure will be a 'point in time' closure of when the function was called, or will the closure take into account state that exists when the closure is actually used.

the_nurk
Автор

The way I understood closures while learning Python: A function that takes another function as input, and returns the original function with some added functionality, without actually modifying the original function. A simple example is returning the the original function with an added timer that prints how much time it took the original function to run.

techcode_man
Автор

Great video as always, Tim!
As you could not think of a reason to store a function inside a var with the returned value, I think it can be very useful in case of concurrent routines inside a for loop, for example

CalebSilvaIdiomas
Автор

So for return functions is this similar to JS callbacks?

msolomonbush
Автор

I hope this course not be a beginner course, we need pro course with pro projects
thanks Tim .

mohamadkenway
Автор

This is actually wrong 6:48 it is not the same as to call the closure function because in that case the actual type of test is a function, and if you call the function as in 6:26 then the type of test is int and it has value of -8.

amirhasanbasic
Автор

awesome tutorial buddy .. will u kindly start web development tutorial using golang ? please !

alfabinomial
Автор

Why is go compiling for so long? I thought it takes no time to run the code :( 8:47

andytheodorko
Автор

can we do this in python, its amazing

vasusubbannavar
Автор

You sure are lacking enough dude. You don't even explained the closures which was the title of video. How ironic

Loki-vyvg
Автор

package main

import "fmt"

func main() {
test := func(x int) int {
return x * -1
}
fmt.Println(test(-4))
}

package main

import "fmt"

func main() {
test := func(x int) int {
return x * -1
}(-4)
fmt.Println(test)
}

kvelez
Автор

Can you make some web dev projects with go videos?

ritikchawla
Автор

Do you work for some company or are you a freelancer?

muradeliyev