We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Format Practice

You've been asked to improve the logs to include information about individual users and their recent messages.

Assignment

Create a userLog variable on line 15. It should contain:

Name: FNAME LNAME, Age: AGE, Rate: MESSAGERATE, Is Subscribed: ISSUBSCRIBED, Message: MESSAGE

Where FNAME LNAME AGE MESSAGERATE ISSUBSCRIBED and MESSAGE correspond to the variables above.

MESSAGERATE should be rounded to the tenths place.

Tips

  • fmt.Sprintf can be used to format strings.
  • %.1f rounds a float to the tenths place, %.2f rounds to the hundredths place, etc.
  • %t formats a boolean value.
  • %v can be used to format any value in its default representation.
  • %s can be used to format a string.
  • %d can be used to format an integer.