Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Integer#ord

int.ord → self

Returns the int itself.

Example
97.ord   #=> 97

This method is intended for compatibility to character literals in Ruby 1.9.

For example, ?a.ord returns 97 both in 1.8 and 1.9.

See also #odd? #pow #numerator #pred also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0