PC a ruseni

Marek Pavlů marekpavlu
Středa Březen 17 14:54:22 CET 2004


> > 
> > function TForm1.logika (A:Boolean;B:Boolean;Combo:TComboBox):Boolean;
> >  begin
> 
> -tohle je zbytecny radek:
> >   If Combo.ItemIndex = 0 then
> 
> 
> >   result:= A and B;
> >   If Combo.ItemIndex = 1 then
> >   result:= A or B;
> >   If Combo.ItemIndex = 2 then
> >   result:= not(A and B);
> >   If Combo.ItemIndex = 3 then
> >   result:= not(A or B);
> >   If Combo.ItemIndex = 4 then
> >   result:= A xor B;
> > end;
> > 

Kdyz uz, tak tohle je opravdu ciste :-))
alespon co se tyce optimalizace, vzhledem k tomu, ze se jedna o exkluzivni podminku 

case Combo.ItemIndex of
  1: result:= A or B;
  2: result:= not(A and B);
  3: result:= not(A or B);
  4:result:= A xor B;
else result:= A and B;
end

S pozdravem
MK




Další informace o konferenci Hw-list