Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need help converting old style def fn functions
#9
(07-14-2022, 07:12 PM)madscijr Wrote: I think this may have been created waaay back in the day, maybe in GW-BASIC or BASIC A?
The "DEF FN" assumes *all* variables are global, that's why it was eventually replaced with SUB/FUNCTION in M$QB. "DEF FN" has no way to declare a variable local, and not even to set its type. That's why when converting one of those to "FUNCTION" the programmer has to watch out for variables that weren't listed as parameters to the function. Also couldn't create a string function with "DEF FN".

Try compiling your code (which looks less than the spaghetti shown above) with "OPTION _EXPLICIT" at the top.
Reply


Messages In This Thread
RE: need help converting old style def fn functions - by mnrvovrfc - 07-23-2022, 07:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Converting a MIDI file to text (csv, tab-delimited, etc.) and back again? madscijr 7 2,304 03-11-2025, 11:00 PM
Last Post: madscijr
  Date functions dritter 31 5,004 05-20-2024, 04:22 PM
Last Post: dano
  Declaring Functions AS TYPEs TerryRitchie 14 2,868 08-17-2023, 12:41 AM
Last Post: bplus
  Questions on style justsomeguy 23 4,443 06-28-2023, 08:31 PM
Last Post: CharlieJV

Forum Jump:


Users browsing this thread: 1 Guest(s)