Min

From Kolmafia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Function Syntax

int min(int a ,int b )

float min(float a ,float b )

  • a is the first number to compare
  • b is the second number to compare

Compares two numbers, and returns the lower of the two. Note that it is possible to mix an int and float type in the parameters, in which case the int parameter will be transparently converted to a float, and the value returned will be of float type.

Code Samples

Simple example using min to determine how many twinkly wads you can currently use based on the amount on hand and your spleen limit.

int amount = min(item_amount($item[twinkly wad]), spleen_limit() - my_spleen_use());
print("You can currently use "+amount+" twinkly wads.", "blue");

See Also

max()