Sha256: cd01c10795199cbec31b48d07ebf06c11340db654079da0503f5de9b29c54523

Contents?: true

Size: 424 Bytes

Versions: 1

Compression:

Stored size: 424 Bytes

Contents

test = { 0 => "element 1", 1 => "element 1", 2 => "element 3", 3 => "element 4" }

iterator = function(hash)
  index = hash["counter"]
  
  if( index == nil )
    hash["counter"] = 0
    index = 0
  end
  
  content = hash[index]
  
  if( type_of(content) == "string")
    print( content )
  end
  
  if( content == nil )
    return()
  end
  
  hash[counter] = index + 1
  call( iterator, hash )
end

call( iterator, test )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
koi-lang-0.0.4 examples/iterator.koi