Originally Posted By: KCN
Just a noob thought...
would be nice to be able to compare more than 2 items directly:

Code:
if (%var1 = %var2 = %var3) instead of 

if ((%var1 = %var2) && (%var2 = %var3))


It would certainly simplify things smile


If you absolutely need something to mimic that behaviour, you could use your own alias as a function/identifier.

Example:
Code:
allequal {
  var %f = $1 , %i = 2 , %n = $0
  while (%i <= %n) {
    if ($ [ $+ [ %i ] ] != %f) { return $false }
    inc %i
  }
  return $true
}


if ($allequal(1,1,1,1,1)) { echo -a all parameters are equal }

This method is probably the best way, albeit a little slow. The plus of it is that you can use variables in it, separated by commas. :P


Or if you really want to keep the syntax in your example (note, that if you use it this way, %var can not contain a =, or this will not work properly.)

Code:
aeq {
  if ($regex($1-,/^((.*?)(?: = \2){1,})$/)) { return $true }
  return $false
}


if ($aeq(one = one = one)) { echo -a they are all one! }



Anyway, enjoy!