11-18-2022, 02:24 AM
TEMP VARIABLES? WE DON'T NEED NO STINKIN' TEMP VARIABLES!
Kidding aside, I generally do things as J described. Very easy to understand and only requires one temp variable, which I usually name as tmp$.
Anyway, the obfuscated function I posted was at least worth a laugh to post.
Pete
Code: (Select All)
a$ = "ABCDEFG"
PRINT a$
a$ = MID$(a$, 1, 3 - 1) + MID$(a$, 5, 1) + MID$(a$, 3 + 1, 5 - (3 + 1)) + MID$(a$, 3, 1) + MID$(a$, 5 + 1)
PRINT a$
SLEEP
PRINT
a$ = "ABCDEFG"
INPUT "Swap letter #1-7: "; x
INPUT "With letter #1-7: "; y
a$ = MID$(a$, 1, x - 1) + MID$(a$, y, 1) + MID$(a$, x + 1, y - (x + 1)) + MID$(a$, x, 1) + MID$(a$, y + 1)
PRINT a$
Kidding aside, I generally do things as J described. Very easy to understand and only requires one temp variable, which I usually name as tmp$.
Anyway, the obfuscated function I posted was at least worth a laugh to post.
Pete