Home  >  Q&A  >  body text

c++ - Ruby的块和C语言的块的区别

巴扎黑巴扎黑2714 days ago583

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理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

    reply
    0
  • ringa_lee

    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

    reply
    0
  • Cancelreply