Ruby: methods as array elements - how do they work?

前端 未结 6 1846
一向
一向 2021-02-19 05:58

This probably isn\'t something you should try at home, but for some reason or another I tried to create an array of methods in Ruby.

I started by defining two methods.

6条回答
  •  清酒与你
    2021-02-19 06:41

    Your array never contains anything else than two nil values. I tricks you by putting the strings when evaluating. But the return value of each function still is nil.

提交回复
热议问题