For Programmers: Free Programming Magazines  


Home > Archive > Cobol > February 2005 > IF-THEN-ELSE Help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author IF-THEN-ELSE Help
Dragfameson

2005-02-07, 11:12 pm

ACCEPT FIRST-QUESTION

IF FIRST-QUESTION IS EQUAL TO 'S'
THEN DISPLAY 'STARTING...'
ELSE
DISPLAY 'HELPING...'
END-IF.

How do I make it so that if FIRST-QUESTION is not
a "S" or "H" it will say INVALID?

I try to do this...

ACCEPT FIRST-QUESTION

IF FIRST-QUESTION IS EQUAL TO 'S'
THEN DISPLAY 'STARTING...'
END-IF
IF FIRST-QUESTION IS EQUAL TO 'H'
THEN DISPLAY 'HELPING...'
END-IF
IF FIRST-QUESTION IS NOT EQUAL TO 'S' OR 'H'
THEN DISPLAY 'INVALID'
END-IF.

But tht dont work right. Because if you DO enter 'S' or 'H'
the output still comes out like this..

STARTING...
INVALID

INVALID shouldnt be there!!!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com