clamp


Description:

[ CCode ( cname = "CLAMP" ) ]
public short clamp (short low, short high)

Example: Clamp:

public static int main (string[] args) {
// Output: ``10``
short s = ((short) 5).clamp (10, 15);
print ("%hi\n", s);

// Output: ``10``
s = ((short) 15).clamp (5, 10);
print ("%hi\n", s);

// Output: ``20``
s = ((short) 20).clamp (15, 25);
print ("%hi\n", s);

return 0;
}

valac --pkg glib-2.0 short.clamp.vala