Posts: 9
Threads: 0
Joined: Jun 2025
Reputation:
1
Yesterday, 06:23 PM
(This post was last modified: Yesterday, 06:35 PM by CookieOscar.)
(Yesterday, 02:48 PM)Kernelpanic Wrote: Same program: Why is the first entry always duplicated here ( summe = Liste(1).Index + Liste(2).Index )? Does anyone have an explanation for this? Thanks!
It's a copy-paste bug.... In your example, it should have been:
Code: (Select All)
...
Input "Zweite Zahl eingeben: ", wert
Liste(1).Index = wert
Input "Zweite Zahl eingeben: ", wert2
Liste(2).Index = wert2 ' <===== should be *wert2* instead of *wert*
...
------------------------------------------------------------------------
(Yesterday, 05:43 PM)hsiangch_ong Wrote: can't believe the commodore 64 is being sold again. i don't think any of the ones sold as we speak. are being used to program in basic.
I beg to differ... strongly!
PS: do you use a STT-system to write your posts (Speech To Text)?
If not, it is a bit hard to read your posts with all the unnecessary punctuation.
But if you use a STT-system then please ignore this comment/suggestion.
Who remembers QB30, GWBASIC, C64, ZX80?
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
7 hours ago
(This post was last modified: 7 hours ago by bplus.)
(Yesterday, 05:43 PM)hsiangch_ong Wrote: not a "naysayer about progress" or alike.
but merely pointing out. this is like the third topic. (not really counting how many.) about the same thing. only because basic pds 7.1 supported it and not quickbasic/qbasic.
if not then something like with... end with like in turbo pascal.
the "possibly related threads" listed are all off. one of them is "arrays as udt's" by pete. i'm not good with names around here. but another of the european users here. created a topic several months ago. because they had some programs to "convert" from basic pds 7.1.
"progress" increasingly means "features of object-oriented language." if not then oh yeah, recall 1970's and 1980's.
can't believe the commodore 64 is being sold again. i don't think any of the ones sold as we speak. are being used to program in basic.
Hey VB for DOS had property arrays way way back in the 90's! So not exactly serious OOP with methods nor even serious progress.
Still turning longstrings into arrays and back again has advatages! You can do more with strings as far as editing elements deleting, slicing middle pieces, mix and matching... strings so much more flexible! no Redim _Preserve when changing string size, beautiful stuff! Since arrays not likely to happen any time soon enjoy work with long strings!
Seriously check this out, I've been doing this for years and years now!
https://qb64phoenix.com/forum/showthread...9#pid22809
@Ikerkaz what justsomeguy showed you is fabulous for numbers I highly recommend that for number arrays. Luke gave us the same thing years and years ago! What I offer is varaible length string "arrays" in longstrings as supplement to numbers arrays in strings, they do have a bit more processing because you have delimiters to deal with but the numbers examples teach how long strings work even if they have fixed item byte sizes.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
It was at .net or .org prob .org, so no link, but its same as posted in this thread by justsomeguy.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
2 hours ago
(This post was last modified: 2 hours ago by bplus.)
@Jack It was in early 2021 here is my copy of justsomeguy code from Luke:
Code: (Select All)
_Title "SetDbl GetDbl Test" '2021-01-31 for Handy Toolbox
ReDim dbl As Double
Print Len(dbl) ' = 8
Print
For i = 0 To 20
SetDbl rndArr$, i, Rnd + i
Next
For i = 20 To 0 Step -1
Print GetDbl#(rndArr$, i)
Next
Sub SetDbl (array$, index As Long, value#) ' Luke's Method except option explicit requires mod, no variables needed for one type
If Len(array$) < 8 * (index + 1) Then array$ = array$ + String$(8 * (index + 1) - Len(array$), Chr$(0))
Mid$(array$, index * 8 + 1) = _MK$(Double, value#)
End Sub
Function GetDbl# (array$, index As Long)
GetDbl# = _CV(Double, Mid$(array$, index * 8 + 1, 8))
End Function
so array$ is your longString to use in your UDT.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 488
Threads: 41
Joined: Apr 2022
Reputation:
40
23 minutes ago
(This post was last modified: 22 minutes ago by Jack.)
thanks bplus
but that basically the same method I had used and the overhead is very high
I am wondering if there is a way to simulate the PowerBasic Dim At
type MyType
s as string*80
end type
dim MyVar as MyType
dim MyNewVar(9) as double at varptr(MyVar.s)
you could then manipulate the array as normal but the values would be stored in the string