What are the reserved words BEGIN or END used for in Ruby?

后端 未结 6 1812
失恋的感觉
失恋的感觉 2021-02-01 18:30

This is a very hard to find word because in most cases they are not sensitive during a search. The best I could find outside of documentation is a test in IRB.

          


        
6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 18:37

    BEGIN and END is also used to comment such as:

    =begin
    This is a comment line
    It can explain what the rest of the program is about
    This was inspired from the perl style of programming
    =end
    

    You can check the same here: https://en.wikipedia.org/wiki/Comparison_of_programming_languages_(syntax)#Comments

提交回复
热议问题