大家讲道理2017-04-17 12:10:06
Because the 'block' of C language and the 'block' of Ruby are different things.
The 'block' of C language is no different from ordinary code except that it is a first-level scope.
As for Ruby's 'block', are you sure you have learned Ruby?
Ruby's 'block' is more complicated. To put it simply, you can think of it as equivalent to a C language function, not just a C language 'block'.
Ruby’s block
ringa_lee2017-04-17 12:10:06
The block you are talking about is a block-level scope in c, but in ruby, there is no way to declare a separate block-level scope like c.
The scope of ruby is generally through the class, def keyword or Expressed using block and lambda