You can subtract two numbers in Ruby by using the '-' operator. Here is an example:
main.rb42 chars5 lines
In this example, we define two variables a
and b
and then subtract b
from a
using the -
operator. The result is stored in variable c
which is then printed to the console using puts
.
gistlibby LogSnag