December 2021
Intermediate to advanced
510 pages
11h 20m
English
You can improve your understanding of the concepts discussed here by doing these exercises:
Add another command-line flag, -b, to count the number of bytes in addition to words and lines.
Then, update the count function to accept another parameter, countBytes. When this input parameter is set to true, the function should count bytes. (Hint: check all the methods available for the type bufio.Scanner in the Go documentation.[12])
Write tests to ensure the new feature works as intended.
Read now
Unlock full access