3 ms·
> I assume: a language where switch statements return a value A language where everything is a value. Yes, a switch statement could be considered a value. More
by whalesalad 2y ago
> I assume: a language where switch statements return a value
A language where everything is a value. Yes, a switch statement could be considered a value. More specifically - these are expressions that can be (but don't necessarily have to be) evaluated into a value. The most practical and introductory example of this is probably Ruby (called case: http://ruby-doc.com/docs/ProgrammingRuby/html/tut_expressions.html#S5 http://ruby-doc.com/docs/ProgrammingRuby/html/tut_expression...).
Python, JS, Ruby all have facilities to do this to varying extents. For a "true" expression-based language you will want to look at something like Clojure.
https://en.wikipedia.org/wiki/Expression_(computer_science) https://en.wikipedia.org/wiki/Expression_(computer_science)