http://www.autoitscript.com/forum/topic/...2-may-11/page__view__findpost_
Results: Variable [pun intended]
Global $eatit, $choice, $stop_watch, $cheese = 1, $laps = 10000 Global $winner[2] = [100000000, 0], $rat[4] = [0,0,0,0], $names[4] = ["If then","If Then EndIf","Switch","Select"] ConsoleWrite("The mouse are asleep, releasing the cheese " &@LF) ConsoleWrite("The cheese is being tested: ") $eatit = TimerInit() ;WARMUP For $i = 1 To 10 Sleep(10) If $cheese = $cheese Then $cheese = $cheese If $cheese = $cheese Then $cheese = $cheese EndIf Switch $cheese Case $cheese $cheese = $cheese EndSwitch Select Case $cheese = $cheese $cheese = $cheese EndSelect Next ConsoleWrite("FDA Approved" &@LF) $choice = InputBox("Pick the winning rat", StringFormat("0 = If then\r\n1 = If Then EndIf\r\n2 = Switch\r\n3 = Select"), 0) ConsoleWrite(@lf& "Setting race: 4 Contestants after " & $cheese & " cheese for "& $laps & " laps" &@lf) For $i = 1 To $laps ;============================= ; if then $stop_watch = TimerInit() If $cheese = 1 Then $cheese = 1 $rat[0] += TimerDiff($stop_watch) ;============================= ; if then endif $stop_watch = TimerInit() If $cheese = 1 Then $cheese = 1 EndIf $rat[1] += TimerDiff($stop_watch) ;============================= ; switch $stop_watch = TimerInit() Switch $cheese Case 1 $cheese = 1 EndSwitch $rat[2] += TimerDiff($stop_watch) ;============================= ; select $stop_watch = TimerInit() Select Case $cheese = 1 $cheese = 1 EndSelect $rat[3] += TimerDiff($stop_watch) Next $eatit = TimerDiff($eatit) ConsoleWrite(@lf& "+ the results are in!!!" &@lf) ConsoleWrite( "> ========================================================================" &@lf) ConsoleWrite( "> "& $names[0] &": "&@TAB& "avg: "& Round($rat[0] / $laps, 15) &", total: "& Round($rat[0],15) &@lf) ConsoleWrite( "> "& $names[1] &": "&@TAB& "avg: "& Round($rat[1] / $laps, 15) &", total: "& Round($rat[1],15) &@lf) ConsoleWrite( "> "& $names[2] &": "&@TAB& "avg: "& Round($rat[2] / $laps, 15) &", total: "& Round($rat[2],15) &@lf) ConsoleWrite( "> "& $names[3] &": "&@TAB& "avg: "& Round($rat[3] / $laps, 15) &", total: "& Round($rat[3],15) &@lf) ConsoleWrite( "> ========================================================================" &@lf) ConsoleWrite( "+ ...and the winner was: " ) For $i = 0 To UBound($rat)-1 If $rat[$i] < $winner[0] Then $winner[0] = $rat[$i] $winner[1] = $i EndIf Next ConsoleWrite( StringUpper( $names[$winner[1]]) & @lf) If $winner[1] = $choice Then ConsoleWrite("+Good choice, you picked the right rat!" & @lf) Else ConsoleWrite("Better luck next time." & @lf) EndIf ConsoleWrite("> Notice: A total of " & (Round($eatit,4)) &" ms could been taken to EAT the cheese!" &@lf)






