Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paranoia
#8
Hi Bartok
I have no great theorical knowledge about "the art of coding"... so I can talk about my ideas and thought on your 2 first examples in the while that you can explaing better to me what it means "beautyfy" a code:
I've used to code as Bplus said... large indipendent block of code that do something with no correlation with the rest of code can be closed in a GOSUB (if it uses global main variables) or in a SUB/FUNCTION (passing global main variables needed by parameters or SHARED) so at the place of [a lot of code 1] you can write SubCode1 and at the place of [a lot of code 2] you can write SubCode2.
What is the difference? You read one row of code at the place of a lot of lines of code... so you can have a easier aspect of the code that gives a more editable and debuggable code.

Talking about the two specific examples that you have posted (the first and the second ones) in the first you have a nested SELECT CASE so the logical flow is clear!
In the second example you have 2 equential SELECT CASE... the code does the same thing until when one of the conditions in the first SELECT CASE is activated AND the flow doesn't come back there after the calling.
to be clearer in the first SELECT CASE of the second example posted, if a condition matches (esc, riavvio, menu) then after activated the linked code the flow mustn't come back there in that SELECT CASE...

PS:
My answer is in english just to be accesible to all QB64 friends of this forum.
Reply


Messages In This Thread
Paranoia - by bartok - 08-13-2022, 03:47 PM
RE: Paranoia - by bplus - 08-13-2022, 04:51 PM
RE: Paranoia - by SMcNeill - 08-13-2022, 04:58 PM
RE: Paranoia - by bartok - 08-13-2022, 08:59 PM
RE: Paranoia - by Kernelpanic - 08-13-2022, 08:16 PM
RE: Paranoia - by Petr - 08-13-2022, 09:16 PM
RE: Paranoia - by bartok - 08-14-2022, 07:28 AM
RE: Paranoia - by TempodiBasic - 08-15-2022, 10:04 PM
RE: Paranoia - by bartok - 08-16-2022, 10:34 AM



Users browsing this thread: 2 Guest(s)