//
// The SWITCH statement is a replacement for the DO CASE statement
// The biggest difference is that the expression (in this case sDeveloper) is only evaluated once.
// which will have a performance benefit over the DO CASE statement
// Empty statement lists for a CASE are allowed. In that case the labels share the code (see CHRIS and NIKOS below)
//
// Please note that EXIT statements inside a switch are not allowed, however RETURN, LOOP and THROW are allowed.
using System.Collections.Generic
Function Start() as void
FOREACH VAR sDeveloper in GetDevelopers()
SWITCH sDeveloper:ToUpper()
CASE "FABRICE"
? sDeveloper, "France"
CASE "CHRIS"
CASE "NIKOS"
? sDeveloper, "Greece"
CASE "ROBERT"
? sDeveloper, "The Netherlands"
OTHERWISE
? sDeveloper, "Earth"
END SWITCH
NEXT
Console.ReadKey()
RETURN
FUNCTION GetDevelopers as List<String>
VAR aList := List<String>{}
aList:AddRange(<string>{ "Chris", "Fabrice", "Nikos", "Robert", "YourName" } )
RETURN aList