![]() Meanwhile, the short declaration is a party animal, only allowed inside functions. See the magic? In the short declaration, Go looks at the value and says, "Ah, this must be an integer!" It's like Go's version of mind-reading.īut remember, the normal declaration can be used anywhere, even outside functions. ![]() It infers the data type from the value you assign to it: Short Declaration: It's like having a friend who just gets you. It explicitly states the data type of the variable: Normal Declaration: This one is like the boss telling you exactly what to do. So, what's the deal? Why choose one declaration over the other? Here's the scoop: It's like the cool kid who's only available at the weekend party. Here are some examples of well-behaved variable names:Įnter fullscreen mode Exit fullscreen modeīut wait, there's a catch! The short variable declaration can only be used inside functions. Let's not play dress-up with variables, okay?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |