Ruby can not access variable outside the method?

前端 未结 3 1321
甜味超标
甜味超标 2021-01-03 22:44

I am new to Ruby, and it seems that Ruby does support variables defined outside the method being accessed just now when I want to do something:


templat         


        
3条回答
  •  情话喂你
    2021-01-03 23:15

    You are declaring local variables, not global ones. See this site for more (simplified) details: http://www.techotopia.com/index.php/Ruby_Variable_Scope

提交回复
热议问题