Maison > développement back-end > Golang > le corps du texte

Apprentissage GO : 02

Patricia Arquette
Libérer: 2024-10-06 14:07:29
original
220 Les gens l'ont consulté

Learning GO: 02

Hey! I am Currently learning Go Lang, and I am taking some basic Notes on my Notion and though I'd also just publish them here. They are not well thought out or well written but it's just me taking notes from time to time for my reference.

I am taking the Udemy Course by Maximilian Schwarzmüller,

Notes

Variable Declarations

variables can be declared via “var” keyword

and also with special assignment operator “:=” so with that we can remove the “var” keyword

this assignment operator is useful when we dont have to change the type of variable that is assigned by GO

because with “:=” we can not declare the type of variable

expectedReturn float64 := 5.5

above is invalid

expectedReturn := 5.5

above is valid

we can declare multiple variables at the same time with same type

var investmentAmount, years float64 = 1000, 10
Copier après la connexion

if we dont declare the type of variable on that line then we can also declare multiple variables with different types

var investmentAmount, years  = 1000, "10"
Copier après la connexion

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

source:dev.to
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Derniers articles par auteur
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!