Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Lines of Code
#14
Code: (Select All)
groupsize = groupsize + 1   'Increase the size of the group by 1
groups = groups + groupsize \ 10  'the there's 10 or more, break them into new groups
groupsize = groupsuze mod 10 'the groupsize of the empty group is now the leftovers

And ^ there's an example where multiple lines are better than that single line of code.  No if to deal with, so no decision making or comparison involved.  Just basic one step maths, with room beside each statement to remark what it's doing and explain the thought process behind it.  It's going to me more efficient than the single line statement, and it even works if large additions were to suddenly pop up such as 23 new people getting off a bus all at once, making it more flexible and easy to expand if the code usage needs an upgrade in the future.

It's more lines of code, but it's BETTER code in many ways, and that's the point I've been trying to make all along.  Few lines of code seldom makes more efficient or better programs.  It just makes more work.  Smile
Reply


Messages In This Thread
[split] Lines of Code - by bplus - 01-20-2025, 05:13 PM
RE: [split] Lines of Code - by bplus - 01-20-2025, 11:05 PM
RE: [split] Lines of Code - by SpriggsySpriggs - Yesterday, 03:02 AM
RE: [split] Lines of Code - by Pete - Yesterday, 07:34 AM
RE: [split] Lines of Code - by mdijkens - Yesterday, 10:07 AM
RE: [split] Lines of Code - by SMcNeill - Yesterday, 02:37 PM
RE: [split] Lines of Code - by mdijkens - Yesterday, 03:04 PM
RE: [split] Lines of Code - by SpriggsySpriggs - Yesterday, 03:17 PM
RE: [split] Lines of Code - by Pete - Yesterday, 04:26 PM



Users browsing this thread: 1 Guest(s)