Skip to content

Commit 0b00fb2

Browse files
committed
tour: added else statement syntax description
Existing description does not contain any description related to else statement. New changes describes syntax for else statement. Fixes: golang/tour#442
1 parent d831351 commit 0b00fb2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tour/content/flowcontrol.article

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ of the `else` blocks.
6969
(Both calls to `pow` return their results before the call to `fmt.Println`
7070
in `main` begins.)
7171

72+
*Note:* Unlike many other languages, Go insists that opening brace of `if` statement should be in same line as `if`.
73+
Similarly, the `else` must be placed on the same line as the closing brace of the corresponding `if` statement.
74+
However, opening brace of `else` can be in the new line.
75+
7276
.play flowcontrol/if-and-else.go
7377

7478
* Exercise: Loops and Functions

0 commit comments

Comments
 (0)