Summer Deals - hours only!Up to 80% off on all courses and bundles.-Close
So you think you can count
Round and other functions
20. Function trunc() – practice
Revision and practice


Good. The last but not the least, function to practice is trunc(x). It always round towards zero.


Show the character's name together with its stat_modifier, followed by the stat_modifier rounded with the function trunc(x,p) to a single decimal place. Observe how it behaves for positive and negative numbers.

Stuck? Here's a hint!

Use trunc(stat_modifier, 1).