-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from tsingbx/assign
add doc for assign
- Loading branch information
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# assignment | ||
// = is used for assigning. The values of multiple variables can be changed in one line. In this way, their values can be swapped without an intermediary variable. | ||
var age int | ||
|
||
age = 21 // = is used for assigning. | ||
println age | ||
|
||
var a, b int = 0, 1 | ||
a, b = b, a // The values of multiple variables can be changed in one line. | ||
println a, b // 1, 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# = vs := | ||
// := is used for declaring and initializing. Multiple variables can be declared and intialized at one line. | ||
age := 21 // age is declared and initialized to 21 | ||
println age | ||
|
||
a, b := 0, 1 // multiple variables can be declared and intialized at one line. | ||
a, b = b, a | ||
println a, b // 1, 0 |
This file was deleted.
Oops, something went wrong.