Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
To Nest or Not to Nest Else
#14
(08-19-2024, 10:19 PM)SMcNeill Wrote:
(08-19-2024, 10:05 PM)TerryRitchie Wrote: That second method caused my brain to get stuck in an infinite loop ... or it possibly divided by 0, I can't tell which, LOL

That's almost exactly what my brain did!   After thinking about it a bit, it makes sense though.  It's just not intuitive to me.

If x < 300 Then 'it's left of the box
ElseIf x > 400 Then 'it's right of the box 
Elseif y < 100 Then 'it's above the box
ElseIf y > 200 Then 'it's below the box
Else 'it's not left nor right, nor above nor below the box... it has to be IN the box!


It works, and I might use it for some code obfuscation challenge, but it hurts my brain to think backwards like that.
The only issue I have with the code is that the IF and all ELSEIF statements must be processed. The method I've always used allows for dropping out of the statements when any of them go FALSE.

Imagine feeding this kind of backwards code thinking to LLMs. Let what appears to be hallucinations along with real hallucinations begin!
There are two ways to write error-free programs; only the third one works.
QB64 Tutorial
Reply


Messages In This Thread
To Nest or Not to Nest Else - by Dimster - 08-17-2024, 03:11 PM
RE: To Nest or Not to Nest Else - by SMcNeill - 08-17-2024, 03:35 PM
RE: To Nest or Not to Nest Else - by PhilOfPerth - 08-17-2024, 11:28 PM
RE: To Nest or Not to Nest Else - by TerryRitchie - 08-17-2024, 06:51 PM
RE: To Nest or Not to Nest Else - by Pete - 08-19-2024, 03:23 AM
RE: To Nest or Not to Nest Else - by Dimster - 08-19-2024, 07:30 PM
RE: To Nest or Not to Nest Else - by SMcNeill - 08-19-2024, 08:58 PM
RE: To Nest or Not to Nest Else - by Dimster - 08-19-2024, 09:08 PM
RE: To Nest or Not to Nest Else - by Pete - 08-19-2024, 09:52 PM
RE: To Nest or Not to Nest Else - by TerryRitchie - 08-19-2024, 10:05 PM
RE: To Nest or Not to Nest Else - by SMcNeill - 08-19-2024, 10:19 PM
RE: To Nest or Not to Nest Else - by TerryRitchie - 08-19-2024, 10:24 PM
RE: To Nest or Not to Nest Else - by Pete - 08-19-2024, 10:10 PM
RE: To Nest or Not to Nest Else - by TerryRitchie - 08-19-2024, 10:14 PM
RE: To Nest or Not to Nest Else - by SMcNeill - 08-19-2024, 10:30 PM
RE: To Nest or Not to Nest Else - by TerryRitchie - 08-19-2024, 10:35 PM
RE: To Nest or Not to Nest Else - by SMcNeill - 08-19-2024, 11:56 PM
RE: To Nest or Not to Nest Else - by Pete - 08-19-2024, 10:53 PM
RE: To Nest or Not to Nest Else - by luke - 08-20-2024, 11:17 AM
RE: To Nest or Not to Nest Else - by OldMoses - 08-20-2024, 12:06 PM
RE: To Nest or Not to Nest Else - by bplus - 08-20-2024, 01:40 PM
RE: To Nest or Not to Nest Else - by Dimster - 08-20-2024, 01:45 PM
RE: To Nest or Not to Nest Else - by bplus - 08-20-2024, 02:08 PM
RE: To Nest or Not to Nest Else - by Pete - 08-20-2024, 04:37 PM
RE: To Nest or Not to Nest Else - by dano - 08-20-2024, 10:54 PM
RE: To Nest or Not to Nest Else - by Pete - 08-20-2024, 11:39 PM
RE: To Nest or Not to Nest Else - by OldMoses - 08-22-2024, 05:28 PM
RE: To Nest or Not to Nest Else - by TerryRitchie - 08-22-2024, 06:45 PM
RE: To Nest or Not to Nest Else - by bplus - 08-22-2024, 05:41 PM



Users browsing this thread: 25 Guest(s)