Is Ruby a functional language?

前端 未结 12 1493
谎友^
谎友^ 2021-01-30 04:09

Wikipedia says Ruby is a functional language, but I\'m not convinced. Why or why not?

12条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 04:36

    Ruby is an object-oriented language, that can support other paradigms (functional, imperative, etc). However, since everything in Ruby is an object, it's primarily an OO language.

    example:

    "hello".reverse() = "olleh", every string is a string object instance and so on and so forth.

    Read up here or here

提交回复
热议问题