What does ON do in QBasic?

I am working on a project in which I take an old program and create a new version of it ... The fact is that it is written in Quick Basic and it has a line of code, t understand

ON FLAG% GOTO 1730, 1900

Can anyone tell me what it is ??? By the way, I'm working on VisualBasic

+4
source share
2 answers

This is basically a shorthand syntax for this type of expression:

IF FLAG% = 1 THEN GOTO 1730 ELSE IF FLAG% = 2 THEN GOTO 1900

See this article for more details .

For more options, you will probably go to instructions switchin more modern languages.

+6
source

This is a more structured example of using the GOTO operator:

SELECT CASE FLAG%
    CASE 1
        GOTO 1730
    CASE 2
        GOTO 1900
END SELECT
+3
source

All Articles