Menu

if then bad written as if the dont work but the interpreter do not repor the error

Anonymous
2016-12-03
2016-12-03
  • Rob Hagemans

    Rob Hagemans - 2016-12-03

    Hi, thanks for your interest! Could you be more specific about what you do and what you see?
    For example, the following works perfectly fine and reports the syntax error as it should:

    if 0 the print
    Syntax error
    Ok
    if 1 the print
    Syntax error   
    Ok
    
     
  • Anonymous

    Anonymous - 2016-12-03

    100 INPUT "OPTION ==>",OP$
    110 IF OP$="1" THEN 120 ELSE 140
    120 INPUT "NEW NAM :", NNM$
    140 IF OP="2" THE 150 ELSE 170
    150 INPUT "NEW LAST NAME :", NLN$
    170 IF OP$="3" THEN 180 ELSE 200
    180 INPUT "NEW ADDRESS :",NAD$

    And so on, you input op$ and allways goto 150 ,and you becom crazy , because de interpreter do not report de sintax error in 140

    these is the modify program ,of a special contacts ,in the clients control section of a inventory control system that i am programing and tailoring for one of my clients, here in venezuela.

    At these moment the system is runing well.

    Your basic is a good one , easy to learn a to program in it, congratulations to you, keep the good work.

    I wass an old COBOL programmer , actualy i am a BASIC programmer, better ,PC-BASIC programmer.

     
  • Rob Hagemans

    Rob Hagemans - 2016-12-03

    Hi, which version of PC-BASIC do you use?
    With 15.08.11 the above program gives me this (I added a $ in 140 to avoid type mismatch):

    100 INPUT "OPTION ==>",OP$                                                 
    110 IF OP$="1" THEN 120 ELSE 140                                            
    120 INPUT "NEW NAM :", NNM$                                                
    140 IF OP$="2" THE 150 ELSE 170                                            
    150 INPUT "NEW LAST NAME :", NLN$                                          
    170 IF OP$="3" THEN 180 ELSE 200                                            
    180 INPUT "NEW ADDRESS :",NAD$
    
    run                                                                        
    OPTION ==>2                                                                
    Syntax error in 140                                                        
    140 IF OP$="2" THE 150 ELSE 170
    

    ... which I think is the correct behaviour.

    Rob

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.