Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Someone please help me with this GWBasic

Status
Not open for further replies.

bryanboi

Newbie level 4
Newbie level 4
Joined
Aug 10, 2004
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
52
Can someone explain to me this source code????

REM If N-3<0 THEN AG = 1 ELSE if N=3=0 THEN AG = 2 ELSE AG = 3
ON (2+SGN(N)*1) GOTO 690, 690, 640
 

Ahh, fond memories of GWBASIC!

REM If N-3<0 THEN AG = 1 ELSE if N=3=0 THEN AG = 2 ELSE AG = 3

"REM" means "remark", so the rest of the line is totally ignored.


ON (2+SGN(N)*1) GOTO 690, 690, 640

The SGN() signum function returns -1, 0 or +1 if the argument is negative, zero, or positive.
The ON () GOTO is a multi-way jump, so if N is negative, zero, or positive, the calculation gives 1, 2, or 3, and then the program jumps to line 690, 690, or 640.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top