Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

ds_list_min

By Daniel · December 26, 2008

Returns the smallest real in a list of reals

// ds_list_min(id)
// Returns the smallest real in a list of reals

var L, size, result, i;
L = argument0;

if (ds_list_size(L) == 0) {
  show_error('Cannot take the min of an empty list', 0);
  return -1;
}

size = ds_list_size(L);
result = ds_list_find_value(L, 0);

for (i = 1; i < size; i += 1)
  result = min(result, ds_list_find_value(L, i));

return result;

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement