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 - 01-21-2025, 03:02 AM
RE: [split] Lines of Code - by Pete - 01-21-2025, 07:34 AM
RE: [split] Lines of Code - by mdijkens - 01-21-2025, 10:07 AM
RE: [split] Lines of Code - by SMcNeill - 01-21-2025, 02:37 PM
RE: [split] Lines of Code - by mdijkens - 01-21-2025, 03:04 PM
RE: [split] Lines of Code - by SpriggsySpriggs - 01-21-2025, 03:17 PM
RE: [split] Lines of Code - by dano - 01-25-2025, 04:08 PM
RE: [split] Lines of Code - by Pete - 01-21-2025, 04:26 PM
RE: [split] Lines of Code - by Jack002 - 01-22-2025, 03:19 AM
RE: [split] Lines of Code - by bplus - 01-22-2025, 12:10 PM
RE: [split] Lines of Code - by Pete - 01-25-2025, 05:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  VS Code and Qb64 pe Unseen Machine 6 729 09-03-2025, 09:42 PM
Last Post: grymmjack
  has anyone had ChatGPT write QB64 code yet? madscijr 13 2,946 08-23-2025, 09:15 AM
Last Post: doppler
  liquid code experiment madscijr 3 491 06-20-2025, 07:26 PM
Last Post: madscijr
  Update Info (split) doppler 2 416 06-17-2025, 12:17 PM
Last Post: doppler
  Splitting REALLY *REALLY* long lines into single character + CR + LF Circlotron 10 1,521 04-22-2025, 11:30 AM
Last Post: Circlotron

Forum Jump:


Users browsing this thread: 1 Guest(s)