Okay guys,I need to solve this problem using minimum if else condition.Let me explain my problem.
Suppose there are three String city,state and country.I need to print it in following format
city,state,country
In case if city=”” then it needs to be
state,country
In case if state=”” the it needs to be
city,country
if country=”” then
city,state
if all string are”” then nothing should be printed or just a “”.
and every other possible conditions.Those three strings may have value or may contain “” not null.So using least if else condition i need to solve this problem.
Note:Not a homework.
1 Answer