Idiom #206 Switch statement with strings
Execute different procedures foo, bar, baz and barfl if the string str contains the name of the respective procedure. Do it in a way natural to the language.
Idiom #8 Create a map (associative array)
Create a new map object x, and provide some (key, value) pairs as initial content.
Idiom #108 Determine if variable name is defined
Print the value of variable x, but only if x has been declared in this program.
This makes sense in some languages, not all of them. (Null values are not the point, rather the very existence of the variable.)
Idiom #295 String to Enum
Given the enumerated type T, create a function TryStrToEnum that takes a string s as input and converts it into an enum value of type T.
Explain whether the conversion is case sensitive or not.
Explain what happens if the conversion fails.
Idiom #223 for else loop
Loop through list items checking a condition. Do something else if no matches are found.
A typical use case is looping through a series of containers looking for one that matches a condition. If found, an item is inserted; otherwise, a new container is created.
These are mostly used as an inner nested loop, and in a location where refactoring inner logic into a separate function reduces clarity.