08-24-2023, 03:00 PM
(This post was last modified: 08-25-2023, 07:40 PM by grymmjack.
Edit Reason: Switched from bold to backticks!
)
@Dav I ran across something that might be useful aside from @mnrvovrfc comments above.
From the Wiki in turn...
https://qb64phoenix.com/qb64wiki/index.php/DO...LOOP
https://qb64phoenix.com/qb64wiki/index.php/FOR...NEXT
https://qb64phoenix.com/qb64wiki/index.php/WHILE...WEND
https://qb64phoenix.com/qb64wiki/index.php/UNTIL
I ran into a unique situation where I needed to switch from a
It was regarding this
I was using a
I dogmatically reach for
Also what do you think this word is using code from above? (@a740g can't play he cheats! (I shared this with him already on discord ))
I'm happy to be wrong and corrected and scolded about my code, BTW!
If you guys know of a better way to shuffle a string than this! @a740g already told me I shouldn't modify the control variable.
But @a740g I found this:
And actually I'm not even using a
...
But not to hijack the thread. It's relevant share in context, and wanted to make sure to share with others.
@Dav it's a serendipitous coincidence so sorry for the intrusion if you feel slighted by this slightly off-topic but-similar share.
From the Wiki in turn...
https://qb64phoenix.com/qb64wiki/index.php/DO...LOOP
Quote:
- DO UNTIL or DO WHILE used with LOOP: The condition is evaluated before running the loop code.
UNTIL checks if the condition is false each time before running code.
WHILE checks if the condition is true each time before running code.
- DO used with LOOP UNTIL or LOOP WHILE: The code block will run at least once:
UNTIL checks if the condition is false before running loop code again.
WHILE checks if the condition is true before running loop code again.
https://qb64phoenix.com/qb64wiki/index.php/FOR...NEXT
Quote:
https://qb64phoenix.com/qb64wiki/index.php/WHILE...WEND
Quote:
https://qb64phoenix.com/qb64wiki/index.php/UNTIL
Quote:
- Only one conditional evaluation can be made at the start or the end of a DO...LOOP.
- DO UNTIL evaluates a condition before and inside of the loop. The loop may not run at all.
- LOOP UNTIL evaluates a condition inside of the loop. It has to loop once.
- Skips the loop or loops until an evaluation becomes True.
I ran into a unique situation where I needed to switch from a
FOR..NEXTto a
DO: LOOP UNTILlast night.
It was regarding this
str_shuffle$function I wrote for my library:
I was using a
FOR..NEXTbut the issue was after exiting, I was doing something in an older version of this which was attempting to use the FINAL value of
i%(my goto var name for iterator) using
ASC(s$, i%)which exceeded the length of the string by 1.
I dogmatically reach for
FOR..NEXTbut will no longer. I wanted to share the findings with you
Also what do you think this word is using code from above? (@a740g can't play he cheats! (I shared this with him already on discord ))
Code: (Select All)
EMUCPSTOR
TSPURMCEO
MRCSTPOUE
TCUSEPRMO
MOTEUPRSC
CPSMEOTRU
OPECSUTRM
MEROUSCPT
TPROECSMU
RSETPOUMC
USECOMTPR
OCTMRPSEU
UCEORMTPS
SUPORCTME
RMPUCSTOE
MTERCSOPU
UPSMCOETR
CRPMTOUES
PEMRCOSTU
EOPCRUMST
CPSRMTOEU
UMRSOTEPC
POCSUTMER
URTMOESPC
UPCRTOSME
PREUOSTCM
TROEUSCPM
MOUPRSTEC
PCOETURMS
PUOSTERCM
I'm happy to be wrong and corrected and scolded about my code, BTW!
If you guys know of a better way to shuffle a string than this! @a740g already told me I shouldn't modify the control variable.
But @a740g I found this:
Quote:Avoid changing the FOR counterVariable's value inside of the loop. This obfuscates code and is a poor programming practice.
Once the loop has been started, changing the variables holding the startValue, stopValue or increment value will not affect loop execution.
And actually I'm not even using a
FOR..NEXTany more.
...
But not to hijack the thread. It's relevant share in context, and wanted to make sure to share with others.
@Dav it's a serendipitous coincidence so sorry for the intrusion if you feel slighted by this slightly off-topic but-similar share.