AnyDice

String with Variables

It is possible to access variables from inside a string. You do so by enclosing the variable with brackets. The variable's value will be converted to a string and replace the reference. However, value conversions will not always result in a something useful.

X: 4
output X named "this is a [X]"
X: d4
output X named "this is a [X]"
X: 2d4
output X named "this is a [X]"
X: {1..4}
output X named "this is a [X]"
X: d{2,4,6}
output X named "this is a [X]"