QP School
Predecessor in Ruby - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: Ruby 3 Tutorials, exercises and examples (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=17)
+--- Thread: Predecessor in Ruby (/showthread.php?tid=2508)



Predecessor in Ruby - Qomplainerz - 02-28-2021

If you want to get the predecessor of a number in Ruby you can do it as follows:


Quote:puts 1.pred


This will print 0 on the screen