I have a book about writing AI code on a Tandy computer from 1981 On Tue, Apr 1, 2025 at 10:01 PM Bill Gunshannon via cctalk < cctalk@classiccmp.org> wrote:
> > So, I am working on another fun project on my trusty old TRS-80's. > I need the ability to do multi-line functions which TRS-80 BASIC > does not support. But in hopes of finding something where someone > added that capability in the distant past (there were lots of features > added by various people over time) I decided to just try a Google > Search. As we all know Google now begins results with an AI generated > answer to your question. This is what I got: > -------------------------------------------------------------------------- > In TRS-80 BASIC, you can create multi-line functions (subroutines) > using the DEF FN statement, allowing you to define a function that > can perform a specific task and be called from different parts of > your program. > > Here's how it works: > > DEF FN Statement: > > You use the DEF FN statement to define a function, followed by the > function name (e.g., FNMyFunction), a set of parentheses for any > arguments, and then the code that the function will execute. > > Example: 10 DEF FNC(X,Y) = X*X + Y*Y defines a function named FNC > that takes two arguments (X and Y) and returns the sum of their squares. > Function Call: > To use the function, you simply call it by its name, passing in the > necessary arguments. > Example: 20 PRINT FNC(3,4) would print the value returned by the FNC > function when called with arguments 3 and 4, which is 25. > Multi-line Functions: > You can extend the DEF FN statement to span multiple lines, allowing > for more complex logic within the function. > Example: > Code > > 10 DEF FNC(X,Y) > 20 LET TEMP = X * X > 30 LET TEMP = TEMP + Y * Y > 40 DEF FN END > 50 PRINT FNC(3,4) > This example defines a function that calculates the sum of squares > of two numbers, but the calculation is broken down into multiple > lines for readability. > Key Points: > Line Numbers: > TRS-80 BASIC relies on line numbers, so make sure to use them > appropriately when defining multi-line functions. > Function Name: > Function names must start with FN followed by a valid identifier > (e.g., FNC, FNMyFunction). > DEF FN END: > You need to use DEF FN END to mark the end of the function > definition, especially when using multi-line functions. > Scope: > Functions are defined within the scope of the program and are > accessible from anywhere in the program. > ----------------------------------------------------------------------- > > Which is both wrong and totally absurd. > > And I see things all the time about letting AI write your code for you. > Does anyone actually trust AI to write code? > > bill >