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…


This content originally appeared on DEV Community and was authored by Gaurav Vala

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

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"


This content originally appeared on DEV Community and was authored by Gaurav Vala


Print Share Comment Cite Upload Translate Updates
APA

Gaurav Vala | Sciencx (2024-10-06T06:00:42+00:00) Learning GO: 02. Retrieved from https://www.scien.cx/2024/10/06/learning-go-02/

MLA
" » Learning GO: 02." Gaurav Vala | Sciencx - Sunday October 6, 2024, https://www.scien.cx/2024/10/06/learning-go-02/
HARVARD
Gaurav Vala | Sciencx Sunday October 6, 2024 » Learning GO: 02., viewed ,<https://www.scien.cx/2024/10/06/learning-go-02/>
VANCOUVER
Gaurav Vala | Sciencx - » Learning GO: 02. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/06/learning-go-02/
CHICAGO
" » Learning GO: 02." Gaurav Vala | Sciencx - Accessed . https://www.scien.cx/2024/10/06/learning-go-02/
IEEE
" » Learning GO: 02." Gaurav Vala | Sciencx [Online]. Available: https://www.scien.cx/2024/10/06/learning-go-02/. [Accessed: ]
rf:citation
» Learning GO: 02 | Gaurav Vala | Sciencx | https://www.scien.cx/2024/10/06/learning-go-02/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.