Skip to content

Commit 73a1844

Browse files
authored
Update README.md
Added code tag for the code
1 parent 38ff57d commit 73a1844

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

022_hands-on/02/05_hands-on/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ We will now break out of the reading.
88

99
Package bufio has the Scanner type. The Scanner type "provides a convenient interface for reading data". When you have a Scanner type, you can call the SCAN method on it. Successive calls to the Scan method will step through the tokens (piece of data). The default token is a line. The Scanner type also has a TEXT method. When you call this method, you will be given the text from the current token. Here is how you will use it:
1010

11+
```
1112
scanner := bufio.NewScanner(conn)
1213
for scanner.Scan() {
1314
ln := scanner.Text()
1415
fmt.Println(ln)
1516
}
17+
```
1618

1719
Use this code to READ from an incoming connection and print the incoming text to standard out (the terminal).
1820

1921
When your "ln" line of text is equal to an empty string, break out of the loop.
2022

2123
Run your code and go to localhost:8080 in **your browser.**
2224

23-
What do you find?
25+
What do you find?

0 commit comments

Comments
 (0)