Is the power of Fixnum! Is the method potentially dangerous?

Why is a method power!in the Ruby class Fixnumcalled with an exclamation mark? By convention, methods that have a name ending in! potentially dangerous (for example, they may somehow modify the instance).

I can appreciate the difference between gsuband gsub!in String, but what about power!? It does not seem to modify the instance Fixnumor perform any other “dangerous” actions; it just returns the result.

+3
source share
1 answer

This is just a mismatch in the API. Nothing to worry about, move forward :)

! , .

+2

Source: https://habr.com/ru/post/1726626/


All Articles