Switch-Case expressions - Cloud

Talend Data Shaping Language Reference Guide

English (United States)
Talend Cloud
Data Shaping Language
Design and Development

You can create switch expressions using the keywords switch, case and default. They evaluate the literals and return a value when a literal matches the switch expression, and can return a default value if none of the literals match the expression. You can specify multiple expressions for the same case, separated by , or ;. In this case, all expressions are evaluated if the condition is met, and the result of the last expression is returned.

These expressions should follow this syntax:
switch (expression1) {
	case literal1: expression2, expression3
	case literal2: expression4, expression5
	default: expression6
The following example is a valid switch expression:
switch (media) { 
	case "Star Wars": message = "May the Force be with you" 
	case "Star Trek": message = "Live long and prosper"
      default: "Cheers"