4 ms·
Same in Ruby, but it doesn't need the parens to cross lines: root.left, root.right = invert_tree(root.right), invert_tree(root.le
by Freaky 11y ago
Same in Ruby, but it doesn't need the parens to cross lines:
root.left, root.right = invert_tree(root.right),
invert_tree(root.left)
- deleted 11y ago[deleted]
- TheLoneWolfling 11y agoI don't like that. I see it as potentially causing more far too many potential problems for such a niece feature. Especially as Ruby has automatic unpacking of function returns, yes? So something along the lines of: a,b = function_returning_two_things(), function_returning_one_thing() could cause bugs.
- Freaky 11y agoThat's certainly possible - this would get you 'a' containing an array from the first function and 'b' with the result of the last. Can't off the top of my head recall actually seeing such a bug. I totally appreciate the desire to reduce the potential for errors from typos, but that ship has kind of already sailed with either language. I guess it just depends how far you're willing to let it go. Yay choice. Testing will catch it anyway, right? :/