Which is more appropriate way of programmming
Posted
by Raju
on Stack Overflow
See other posts from Stack Overflow
or by Raju
Published on 2010-06-02T08:08:19Z
Indexed on
2010/06/02
8:14 UTC
Read the original article
Hit count: 288
programming
If a variable can take n values should we check for the validity of the values or assume that if all the n-i checks fail it would be the nth value.
For example if we have a variable that stores gender as M or F
If gender = "M"
do male_processing
else
do female_processing
endif
If gender = "M"
do male_processing
else
if gender = "F"
do female_processing
else
print "Something has gone wrong Gender has a value " Gender
endif
endif
© Stack Overflow or respective owner