xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HFill()

Copies the same value into all key/value pairs.

Syntax

HFILL( <Hash>, <xValue> ) --> NIL

Arguments

<Hash>
A variable referencing the hash to fill with a value.
<xValue>
The value to copy to all key/value pairs of <hHash>

Return

The function returns always NIL.

Description

The function uses a single value <xValue> and copies it to all key/value pairs of a hash. This is useful when a unified state must be achieved for all items in the hash. Use only simple data types for <xValue> (C,D,L,N).

Info

See also:Hash(), HSet(), HSetValueAt(), HScan()
Category: Hash functions , xHarbour extensions
Source:vm\hash.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example shows the effect of HFill()

   PROCEDURE Main
      LOCAL hHash := { "a"=> 10, "b" => 20, "c" => 30 }
      LOCAL aValues

      ? ValToPrg( HGetValues(hHash) )   // result: { 10, 20, 30 }

      ? HFill( hHash, "A" )             // result: NIL

      ? ValToPrg( HGetValues(hHash) )   // result: { "A", "A", "A" }
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe