-
Notifications
You must be signed in to change notification settings - Fork 0
Intro to Programming (Go)
Michelle L edited this page Mar 31, 2019
·
10 revisions
[Source: DeviantArt]
Go (or "Golang") is an open source programming language developed by Google that was first released in 2009. Since then it has been steadily growing in adoption. We decided to use Go for the backend of this project because it's faster, more stable, and has less syntax than other popular languages.
"Go will be the server language of the future." -Tobias Lütke, founder of Shopify
Concurrency is the ability to run many processes at the same time.
Code readability vs. efficiency
Source: Keval Patel, "Why should you learn Go?" (click to read more)
Video: Ladders to the Moon (3:15 - 13:12)
Talk by Ramsey Nasser @ Eyeo 2015
All values in a programming language have a "type" - such as an integer, Boolean, or string - that dictates how the computer will interpret it. For example 7 + 5
is interpreted differently from "7" + "5"
Primitive data types are the basic building blocks of data. They are universal across all programming languages (for the most part).
- Open https://goplay.space to start writing Go!
- Ephemeral "play space"
- Customize settings
- Print "hello world"
- Print
7 + 5
- Print
"7" + "5"
A variable is a placeholder for a piece of information that can change over time. It's actually a reference to a specific location in memory where the value is stored/updated.
- CREATING A VARIABLE:
- UPDATING A VARIABLE:
- Create a variable called
score
that gets the value 0 - Print the value of
score
- Update
score
to get its current value + 5 - Print the value of
score
again - Update
score
to get its current value - 2 - Print the value of
score
again
-
num % 2
returns the remainder after dividingnum
by2
- If it returns
0
, we knownum
is an even number