Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmatthew steiner
6,264 PointsWhat is "#"f?
Just wondering what the number before f represents when designating the playerAnimation.SetFloat. I changed the number to a variety of different numbers, but it didn't seem to have any effect on how fast the frog jumps. Is it supposed to go faster or slower?
2 Answers
Patrick Cooney
12,216 PointsHaven't taken this course yet but typically an "f" after a number explicitly declares you want it to be a float. In many weakly typed languages if I type "10" it will automatically be made an Int by the language. However if you type "10f" you're telling it to be a float so that it has as much precision as needed.
matthew steiner
6,264 PointsGot it, I think. So the 10 in 10f would be how much precision you are allowing that float to be?
Patrick Cooney
12,216 PointsSorry, I should have given you a link from the start. Here is a link to the C# reference pages that explains this. It's not setting the precision but rather telling it to be a float which allows for more precision.