02-28-2021, 08:40 AM
Example 1
Let's assume our number is 12.12 and we want to print the floor without any precision:
This will print 12 on the screen
Example 2
Let's assume our number is 12.12 and we want to print the floor with a precision of 1 decimal place:
This will print 12.1 on the screen
Example 3
Let's assume our number is 12.12 and we want to print the floor with a precision of 2 decimal places:
This will print 12.12 on the screen
Let's assume our number is 12.12 and we want to print the floor without any precision:
Quote:puts 12.12.floor
This will print 12 on the screen
Example 2
Let's assume our number is 12.12 and we want to print the floor with a precision of 1 decimal place:
Quote:puts 12.12.floor(1)
This will print 12.1 on the screen
Example 3
Let's assume our number is 12.12 and we want to print the floor with a precision of 2 decimal places:
Quote:puts 12.12.floor(2)
This will print 12.12 on the screen
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos