jeudi 24 janvier 2019

Why do we use endif statement?

Why do we write endif statement in this program? Without writing it, we can easily get our result. Is there any example through which you can explain me the use of endif statement?

I have tried this:

INPUT X
IF X>10 THEN PRINT "X IS GREATER THAN 10" ELSE PRINT "X IS NOT GREATER THAN 10"
END

then I am also getting expected result.

The real code is:

INPUT X
IF X>10 THEN 
PRINT "X IS GREATER THAN 10"
ELSE
PRINT "X IS NOT GREATER THAN 10"
END IF
END

EXPECTED AND DESIRED
FOR EXAMPLE:
When X=5 then output will be "X IS NOT GREATER THAN 10".

Aucun commentaire:

Enregistrer un commentaire