Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ON do in QBasic?

Tags:

qbasic

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

ON FLAG% GOTO 1730, 1900

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

like image 211
sheach Avatar asked Dec 25 '22 04:12

sheach


1 Answers

It is basically a shorthand syntax for this type of statement:

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

See this article for more information.

For more options you would probably turn to a switch statement in more modern languages.

like image 193
Lasse V. Karlsen Avatar answered Jan 18 '23 10:01

Lasse V. Karlsen