IF ELSE EVAL() execution error

I’m taking column names in parameter after that if that parameter contains single column name then simply evaluating that column and if contains multiple column names in parameter then printing else part, but when i’m passing multiple column names it’s execution eval() function also it should not execute that part it should execute else part. please help.

Deduplicate dynamic columns.morph (3.9 KB)

In an expression, the eval() function is always evaluated first (pre-evaluated), and only then the whole expression is evaluated for every row. Therefore, the correct syntax is:

    IF not contains({Columns}, ',')
        '[' & {Columns} & ']'
        '"Multiple columns"'

Notice that '"Multiple columns"' is wrapped in quotes twice (single quotes and double quotes) because it must evaluate to "Multiple columns" (a valid text constant), not Multiple columns (which would be an invalid expression).

See also the example below:
test-eval.morph (3.2 KB)

Thanks @dgudkov.