Pete's Dumb Idea of the Day! - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Pete's Dumb Idea of the Day! (/showthread.php?tid=3147) Pages:
1
2
|
Pete's Dumb Idea of the Day! - Pete - 10-21-2024 Wouldn't it be nice to have this feature for Data Restore? On x Restore data1, data2, data3 instead of needing to code... Select Case x Case 1: Restore data1 Case 2: Restore data2 Case 3: Restore data3 End Select data1: data eof data2: data eof data3: data eof Be sure to post your hate comments in a respectful, non-micro-aggressive and culturally appropriate manner. Oh who am I kidding? Comment however the hell you want! Pete RE: Pete's Dumb Idea of the Day! - TempodiBasic - 10-21-2024 (10-21-2024, 07:53 PM)Pete Wrote: Wouldn't it be nice to have this feature for Data Restore?Hi Pete what do you think about this alternative solution? Code: (Select All)
the trick is to heading the label of data selected with a restore to itself and a return to come back to the main loop of reading data. Yes it use GOSUB and not GOTO. But if you like you can put a label at the start of reading instructions and coming back GOTO to that label from data area. RE: Pete's Dumb Idea of the Day! - CharlieJV - 10-22-2024 (10-21-2024, 07:53 PM)Pete Wrote: Wouldn't it be nice to have this feature for Data Restore? Yup, that is very BASIC to me: https://basicanywheremachine.neocities.org/bam-progreference?target=Bookmarks%3A%3AON%20RESTORE#Home RE: Pete's Dumb Idea of the Day! - dano - 10-22-2024 Sure! That would be awesome. You know what would be better??? If we could get _Resize working properly !!! WooHoo...that would be incredible. RE: Pete's Dumb Idea of the Day! - Pete - 10-22-2024 Yeah, _Resize can be a pain. That's why I use _Viagra. Now if you work with smaller apps, like Steve, it's not so necessary. Oh, and see, Charlie beat you guys to it! +1 And for my friend from my families homeland... I think you managed to go in the opposite direction, and find a more complicated way than Select Case, but it did showcase just how cool creativity is when it comes to coding! +1. Pete RE: Pete's Dumb Idea of the Day! - bplus - 10-22-2024 Who the hell reads data so much, just get an array and be done with it. But it's not the dumbest idea I ever saw. Who the hell can't make up their mind what size they need, pick one bigger than you will ever need, the space will fill, it's a law of nature. Size does matter, a little... Since we are wishing here, I want a keyboard that types the words I mean not the ones that come out at the ends of my fingers, wait that can't be at the top of my list,... for QB64? Ah, arrays! Functions that can return them and Types that can accommedate them (spell checker in forum editors) and while at it, Functions that return UDT's. Lets focus on that people! RE: Pete's Dumb Idea of the Day! - a740g - 10-22-2024 Other languages have "Array initialization" features, but QB64 does not. I'm not too fond of DATA, but that's a personal choice. I'd rather see true array initialization capability in QB64. https://github.com/QB64-Phoenix-Edition/QB64pe/issues/47 Other interesting stuff: https://github.com/QB64-Phoenix-Edition/QB64pe/issues/30 https://github.com/QB64-Phoenix-Edition/QB64pe/issues/135 https://github.com/QB64-Phoenix-Edition/QB64pe/issues/212 RE: Pete's Dumb Idea of the Day! - Petr - 10-22-2024 I'm uncomfortable with it. Data is good for a hard-coded part of the program where nothing will change. But - during development, who never changed anything? I like the solution with an array and a function that returns it all as a result much better, even if it takes more time to write the function. Something like this: Code: (Select All)
RE: Pete's Dumb Idea of the Day! - TempodiBasic - 10-22-2024 @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)
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. RE: Pete's Dumb Idea of the Day! - Pete - 10-23-2024 Well with Select Case you would use... Code: (Select All)
Pete |