Create own functions in Basic (Beta)

Is it possible to create user-defined functions in the Basic (Beta) programming language? I don’t think it is documented on the docs site, so I am asking here.

Please help!

Maybe take a look at this: BETA (programming language) - Wikipedia

Also, I am moving this to code help

I don’t know if that is the correct programming language, because it doesn’t look the same as the Basic (Beta) programming language here on Replit. If you are confused, here is the link to the docs page for Basic (Beta) on Replit:

This might help. I’m not an expert with BASIC (BASIC isn’t really a language that applies very well to the real-world, anything achievable in basic is achievable in other programming languages that will be better and more complete), but what I’d do is just make use of GO TO and variables.

10 LET X = 0
20 LET Y = 0
' multiply, a "function"
40 RESULT = X * Y
' ...
1010 X = 5
1020 X = 9
' "call" the multiply function
1030 GOTO 40
1040 print RESULT

I haven’t used basic in a long time, so that code might be incorrect, but it should give you the gist of what I’m suggesting. The link I put above talks about real functions in BASIC, however I’m not sure about Replit’s implementation of BASIC and what it supports/can do so don’t be surprised if functions don’t work.

1 Like