Hi guys,
I have been programming for alot of time. Generally i program in some languages like PHP, ASP.net, Java, JavaScript and others. In all languages i have to use alot of if else statments . Like if value= 10 then ... if i review my code then i find alot of if conditions. So i would like to minimise them but how not sure.
one point was using classes somewhat minimised but still they are more...
like task, cat, sec and type:
if task = 'add' then
if cat = "animal" then
if sec = "man" then
if type = "male" then
'do the following stuffs
else
'do the following stuffs
end if
elseif sec = "horse" then
if type = "run"
'do the following stuffs
else
'do the following stuffs
end if
elseif....
end if
elseif cat = "plant" then
if sec = "land" then
if type="tree" then
'do the following stuffs
elseif type = "grass" then..
'do the following stuffs
elseif...
end if
elseif sec = "water" then
...
...
...
more n more continue n continue
so wonder how can i minimise them and write some efficient codes?
Sorry to inform lately that there may be alot of values for task, cat, sec, and type. My if statements are going nested n nested.
More explanatory my code also looks like same as :
http://thedailywtf.com/Articles/Coding-Like-the-Tour-de-France.aspx