Skip to content

Conversation

@aakaru
Copy link

@aakaru aakaru commented Apr 2, 2025

  • Replaced fmt.Scanln() with bufio.NewReader() which handles user input better, especially when users enter non-numeric values or whitespace.
  • Improved error messages with more specific info for users, and added validation for the unit type (must be "C" or "F").
  • Added proper parsing of the temperature value with error checking using strconv.ParseFloat().
  • Removed global variables and made them local to where they're needed.
  • Changed the temperature output format to show one decimal place for more precision (.1f instead of .0f).

- Replaced fmt.Scanln() with bufio.NewReader() which handles user input better, especially when users enter non-numeric values or whitespace.
- Improved error messages with more specific info for users, and added validation for the unit type (must be "C" or "F").
- Added proper parsing of the temperature value with error checking using strconv.ParseFloat().
- Removed global variables and made them local to where they're needed.
- Changed the temperature output format to show one decimal place for more precision (.1f instead of .0f).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant