سلام
برنامه ای دارم که در آن باید تعداد زیادی if تو در تو داشته باشم که بتوانم کارم را به درستی انجام دهم. به نظر من این کار زیاد جالب نیست. در ضمن if ها تعداد سطوح مختلفی دارد. مثلاً در یک جا 4 تا if تو در تو داریم و در جایی دیگر 2 تا و الی آخر...
if cboMainAct.Text = 'test 1' then
begin
if cboSubAct = 'test 1-d' then
begin
if edt1.text = 'hello' then
// do somethings
else if edt2.text := 'B' then
// do somethings
end
else
if cboSubAct = 'test 1-2' then
begin
if edt1.text = 'hello' then
// do somethings
else
// do somethings
end
else
if cboSubAct = 'test 1-d' then
begin
if edt1.text = 'hello' then
// do somethings
else
// do somethings
end
else
if cboSubAct = 'test 1-2' then
begin
if edt1.text = 'hello' then
// do somethings
else
// do somethings
end
end;
else
if cboMainAct.Text = 'test 2' then
begin
// do somethings
// do somethings
end
else
// other conditions
آیا دوستان تکنیک بهتری را برای حل این مسئله سراغ دارند؟
با تشکر از راهنمایی شما دوستان...