c++ - Ruby的块和C语言的块的区别
巴扎黑
巴扎黑 2017-04-17 12:08:06
0
2
651
巴扎黑
巴扎黑

reply all(2)
大家讲道理

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

左手右手慢动作

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template