Home: Tip of The Day: Simple Combination Example: 
Tip of The Day - Simple Combination Example

Print out all the combinations of the ways the last 4 survivors can be voted off.

#GorillaScript:
set $List=$New.Array();
$List.Add(NAME,"Ethan");
$List.Add(NAME,"Kim J");
$List.Add(NAME,"Lex");
$List.Add(NAME,"Tom");

set $Endings=$New.Array();

forevery($a,$List)
{ forevery($b,$List)
{ forevery($c,$List)
{ forevery($d,$List)
{ if($a.NAME.NotEquals($b.NAME))
{ if($a.NAME.NotEquals($c.NAME))
{ if($a.NAME.NotEquals($d.NAME))
{ if($b.NAME.NotEquals($c.NAME))
{ if($b.NAME.NotEquals($d.NAME))
{ if($c.NAME.NotEquals($d.NAME))
{ $Endings.Add(A,$a.NAME,B,$b.NAME,C,$c.NAME,D,$d.NAME);
}
}
}
}
}
}
}
}
}
}

forevery($Ending,$Endings)
{ $Ending.A;" ";$Ending.B;" ";$Ending.C;" ";$Ending.D;<br>
}
Download  |  Tutorial  |  Documentation  |  Pricing  |  Contact