Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pete's Dumb Idea of the Day!
#9
@a740g 
 I have used sometimes DATA and READ and RESTORE for fun, but their logic is far away from chunking down a task in so many littler tasks.

@Petr
Yes your is a more modular code

@Pete
I have proposed a tricky way to build an ON x RESTORE label1,label2,label3....,labelN-1, labelN
it works because if you declare a label in the right part of the line of code ( just after RESTORE) you must also type the label in the code.
Using SELECT CASE a unpredictable value causes troubles...
run this code
Code: (Select All)
 
Rem  demo Restore : On x Restore idea    vs Select Case

For x = 0 To 4
    On x GOSUB data1, data2, data3, data4
    Read number, nam$, Order$
    Print number, nam$, Order$
Next
Print "----------------------------------------------"
For x = 0 To 4
    Select Case x
        Case 1
            Restore data1
        Case 2
            Restore data2
        Case 3
            Restore data3
        Case 4
            Restore data4
    End Select

    Read number, nam$, Order$
    Print number, nam$, Order$
Next

End

data1:
Restore data1
Return
Data 1,one,the first

data2:
Restore data2
Return
Data 2,two,the second


data3:
Restore data3
Return
Data 3,three,the third

data4:
Restore data4
Return
Data 4,four,the forth

but I haven't found any function dedicated to RESTORE in internal code of QB64.
There is only a managing of pointer into section of QB64IDE.
So I dunno how RESTORE is coded into c++ and how it can be expanded.
Reply


Messages In This Thread
Pete's Dumb Idea of the Day! - by Pete - 10-21-2024, 07:53 PM
RE: Pete's Dumb Idea of the Day! - by TDarcos - 10-23-2024, 02:47 AM
RE: Pete's Dumb Idea of the Day! - by CharlieJV - 10-22-2024, 12:01 AM
RE: Pete's Dumb Idea of the Day! - by dano - 10-22-2024, 01:08 AM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-22-2024, 05:55 AM
RE: Pete's Dumb Idea of the Day! - by bplus - 10-22-2024, 10:40 AM
RE: Pete's Dumb Idea of the Day! - by a740g - 10-22-2024, 11:46 AM
RE: Pete's Dumb Idea of the Day! - by Petr - 10-22-2024, 03:57 PM
RE: Pete's Dumb Idea of the Day! - by TempodiBasic - 10-22-2024, 09:58 PM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-23-2024, 01:01 AM
RE: Pete's Dumb Idea of the Day! - by SMcNeill - 10-23-2024, 03:54 AM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-23-2024, 07:59 AM
RE: Pete's Dumb Idea of the Day! - by CharlieJV - 10-23-2024, 01:07 PM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-23-2024, 05:37 PM
RE: Pete's Dumb Idea of the Day! - by CharlieJV - 10-23-2024, 08:09 PM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-23-2024, 10:29 PM



Users browsing this thread: 13 Guest(s)