Ad
  • Custom User Avatar

    Thank you for the reply! This really clears things out.

  • Custom User Avatar

    This is just another way to define a function, so there should be no perfomance difference. It's mentioned in the docs as "assignment form". It's often preferable when it can be used while remaining readable like in this example. I like to do this for fun, however, if you see some of my more contrived "assignment form" solutions on codewars, in practice, they often could be better as full function definitions to improve readability, by expanding out, and/or performance, by using more efficient algorithms/memory management/etc which the compactification didn't allow for.

  • Custom User Avatar

    I like this one, eventhough I'm not sure that it's better than the others.

  • Custom User Avatar

    Performance-wise, would this be better or worse than defining a function and why?