4 ms·
Why did they subtract one from (length all-files) in the gif?
by codetrotter 8y ago
Why did they subtract one from (length all-files) in the gif?
- 314 8y agoThere is a blank line from find captured in the array. I think it is to remove it from the count.
- andrewchambers 8y agoThat is right, I also just wanted to show you can do some basic calculation easily inline.
- iBelieve 8y agoLooks like the last item in the all-files array is an empty string - maybe that's why? Either that, or the current directory (".") might be included as the first element.
- codetrotter 8y agoIf . was included then .. almost certainly would be as well. But an empty string at the end like you say and as explained by the sibling comment makes sense.
- andrewchambers 8y agoThe empty line after the split was the reason, also to demonstrate how to do arithmetic.