So...you THINK you know Go?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
go is known for making things as simple and boosting productivity however this definitely does not mean that all things in goal are easy to master or understand every programming language or technology has its own unique features that may not be so approachable so let's dig into the Lesser known and talked about the features of go in today's video before we get started make sure to get your free and go language at golang dojo.com cheat sheet first let's talk about negative return if you haven't already figured it out with a go Las is more every feature in Gold source is a purpose and nothing more this philosophy is The Guiding Light to how go was created and what makes it such a pleasant programming language to work with for so many developers however when talking about negative return you might feel like there's a feature in go oh could possibly go off the rails in terms of Simplicity and bring in unnecessary complexity for example let's have a simple function at which it takes in two parameters and Returns the sum to incorporate negative return we can add a name with tone by giving the return type a variable name use it as a variable as in already declared a variable remove the variable under the return statement because the variable declared next to the return type specifies the exact same thing in short negative returns in goal are returning without the usual expected variables negative returns seem interesting right to be a hundred percent honest I personally believe it adds unnecessary complexity to the code base even in the official documentations it states they can harm readability in longer functions for the sake of writing simpler in more understandable code in my opinion it's completely fine to just say no to naked Returns the next feature in go that's unlikely to be the center of attention especially among go beginners would be untied constant untyped a constants it gives us a lot more flexibility but also a little bit unusual for example when we declare a regular variable instead of a constant vo I ain't equals one is the exact same as VAR I equals one however when we try to declare a constant constant I end equals one is not equal to const I equals one this is because when we declare a constant and we do not specify its type it remains to be untyped and so there's a constant a value gets directly used or referenced in a print statement for example this is especially useful when we need constants that are either obscenely large or that we want to keep a high level of precisions which is an attribute that is not a convenient leads available in variables next we have utf-8n Rune utf-8 is the encoding system that was created which allows a single byte and multi-byte characters to coexist in a single sentence or string if you are coming from a computer science background or if you have a tick in any of the csf50 courses you should be familiar with the ASCII table all of the characters in The ASCII table can be represented by one single byte memory space however one single byte is only large enough for English or Latin based alphabet there are hundreds of thousands or even millions of characters in other languages they combine this is where utf-8 encoding comes into play allowing single byte up to 4 by characters to coaxes which is enough to represent the world's most common languages conveniently go natively supports utf-8 in this example the Chinese characters world are three bytes each however if you assign these Chinese characters into their own variables they will be four bytes each because a goal by default it uses rune for characters whose underlying type is int32 which takes up 4 byte in memory next let's talk about unsafe go and the usage of unsigned into pointer now you may have heard that a go does not support pointers aromatics however that is actually not a hundred percent true in go just like any other C like programming languages there are ends and unsigned in into is array range from negative and nine quintillion into positive and nine quintillion while unsigned ends doubles that and ranges from zero to Max enter times two utilizing the actual sign a bit to maximize the value is stored and unsigned in the pointer extends that usage even further with unsafe go one purpose of unsigned enter pointers is to be used along with unsafe pointers for unsafe memory access since arithmetic operations cannot be performed on unsafe pointers to perform such an aromatic and unsafe a pointer is first converted to an unsigned inter pointer the aromatic is then performed on the unsigned ends pointer finally the unsigned answer pointer is converted back to an unsafe pointer to access the object now pointing to the new memory address so these are some of the less I talked about aspect self gulp at least in your typical YouTuber tutorial if you found this video helpful make sure to leave this video a thumbs up and a comment down below if you have any questions or if you have any additional input get your free golang cheat sheet at golang dojo.com cheat sheets and I'll see you ninjas in the very next video [Music] thank you [Music]
Info
Channel: Golang Dojo
Views: 16,164
Rating: undefined out of 5
Keywords: golang, learn golang, go lang, go language, golang tutorial, go programming, golang for beginners, golang 2022, why golang, programming, why learn golang, golang tutorial for beginners, go tutorial, go tutorial for beginners, go for beginners, golang pointers, golang programming, pointers golang tutorial, golang constants, go constants, golang data types, learn golang fast, learn golang for beginners, go programming language, golang uint, unsafe.pointer, unsafe golang
Id: nZ4C6iXF4vo
Channel Id: undefined
Length: 6min 34sec (394 seconds)
Published: Sat Nov 26 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.