Why O/P is displaying 3 at the end while giving command 3.times{print"Hello"}

ruby

#1

I wrote command
3.times{print"Hello"}
3.times{puts"hi "}

I am Getting o/p as
HelloHelloHelloHi
Hi
Hi
3


#2

Ruby prints out to the console value returned by the last evaluated statement.

In case of #times method it is int, the last value of iterator if block of code is defined or enumerator if the block is not defined, example:

6.times
=> #<Enumerator: 6:times>

3.times {
    puts "Hello"
}
>> Hello
>> Hello
>> Hello
=> 3