# Method Gdbm.DB()->nextkey()

Method nextkey

  `string(8bit) nextkey(string(8bit) key)`

Description

  This returns the key in database that follows the key 'key' key. This is of course used to iterate over all keys in the database.

Note

  Changing (adding or removing keys) the database while iterating can cause keys to be skipped.

  The database also works as an Iterator, and can be used as the first argument to foreach.

Example

  // Write the contents of the database for(key=gdbm->firstkey(); k; k=gdbm->nextkey(k)) write(k+":"+gdbm->fetch(k)+"\n");

Or, using foreach

    // Write the contents of the database
     foreach( db; string key; string value )
        write(key+":"+value+"\n");