Monument ShadowMUD

Fighter

[07-27 21:03][Fighter]Icewolfz: var / (var || 1) is the safest
[07-27 21:03][Fighter]Icewolfz: works with 0 or -1
[07-27 21:04][Fighter]Aim: screw it. var / (var + pi )
[07-27 21:04][Fighter]Icewolfz: lol what if var is pi ;)
[07-27 21:04][Fighter]Aim: what are the odds of 3.1415926 .. :)
[07-27 21:04][Fighter]Icewolfz: granted you could proablay force it ot do floating math and do to_int(to_float(var) / (to_float(var2) + 0.5))
[07-27 21:05][Fighter]Icewolfz: granted that cna throw stuff off
[07-27 21:05][Fighter]Icewolfz: overall var || 1 is the shortest way
[07-27 21:05][Fighter]Icewolfz: esle if(!var) var = 1; var / var;
[07-27 21:05][Fighter]Icewolfz: you could aos do var / !var ? 1 : var
[07-27 21:05][Fighter]Aim: whoa.
[07-27 21:06][Fighter]Aim: if not var or 1 then var ?
[07-27 21:06][Fighter]Icewolfz: yeah ? : is an inline veriso nof if true else false
[07-27 21:06][Fighter]Icewolfz: its the same as if(!var) 1 else var
[07-27 21:07][Fighter]Icewolfz: may want ot use a () wrapper ot be safe
[07-27 21:07][Fighter]Aim: so i did get the concept
[07-27 21:07][Fighter]Icewolfz: most c type lands support ?: operator nowadyas
[07-27 21:07][Fighter]Icewolfz: it is useful for closers
[07-27 21:08][Fighter]Aim: and less typing
[07-27 21:08][Fighter]Icewolfz: eg (: $1 == 'blah' ? this : that
Back to List

ShadowMUD
03:02, Shadowday, Kepki 16, 170 AD.

Vote for Our Mud on TMC! Desert Bus for Hope