02-28-2021, 08:35 AM
Example 1:
Let's assume our number is 1.1 and we want to print the ceil without any precision:
This will print 2 on the screen, because 1.1 is rounded up to the next whole number.
Example 2:
Let's assume our number is 1.1 and we want to print the ceil with a precision of 1 decimal place:
This will print 1.1 on the screen, because 1.1 is rounded to the nearest 1st. decimal place.
Example 3:
Let's assume our number is 1.1 and we want to print the ceil with a precision of 2 decimal places:
This will print 1.11 on the screen, because 1.1 is rounded to the nearest 2nd decimal place.
Let's assume our number is 1.1 and we want to print the ceil without any precision:
Quote:puts 1.1.ceil
This will print 2 on the screen, because 1.1 is rounded up to the next whole number.
Example 2:
Let's assume our number is 1.1 and we want to print the ceil with a precision of 1 decimal place:
Quote:puts 1.1.ceil(1)
This will print 1.1 on the screen, because 1.1 is rounded to the nearest 1st. decimal place.
Example 3:
Let's assume our number is 1.1 and we want to print the ceil with a precision of 2 decimal places:
Quote:puts 1.1.ceil(2)
This will print 1.11 on the screen, because 1.1 is rounded to the nearest 2nd decimal place.
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