[fpc-pascal] Syntax to select constant or variable with function call

wkitty42 at windstream.net wkitty42 at windstream.net
Sun Sep 24 16:50:37 CEST 2017


On 09/24/2017 01:55 AM, Michael Van Canneyt wrote:
> Then define
> function Find_Color(anArray :PVGA256Array; r ,g ,b : Word) : Byte;
>   Var
>    Dist,closest:Double;
>    i,bestchoice:Byte;
> 
> begin
>     Closest:=200000;
>     For i:= 0 to 255 do
>        Begin
>           Dist :=  ((R-AnArray^[i].R))*((R-AnArray^[i].R))
>                      + ((G-AnArray^[i].G)*(G-Anarray^[i].G))
>                      + ((B-AnArray^[i].B)*(B-AnArray^[i].B));
>           If Dist<Closest Then
>              Begin
>                 Closest:=Dist;
>                 BestChoice:=i;
>              End;
>        End;
>     Find_VGA:=BestChoice;
> end;


should that be Find_Color:=BestChoice; ??


-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list unless*
        *a signed and pre-paid contract is in effect with us.*



More information about the fpc-pascal mailing list