← parentheses operator page · general/parentheses/sc/nested_parentheses
pandas ✅ · DuckDB ✅
Nested parentheses, ( SC_1 - SC_2 / (SC_3 + SC_4) ) * SC_5 with SC_1 = 20, SC_2 = 10, SC_3 = 2, SC_4 = 3 and SC_5 = 3: the inner ones are evaluated first.
Parentheses: "If more parentheses are nested, the inner parentheses are evaluated first, for example ( 20 - 10 / (2 + 3) ) * 3 would give 54."
2 + 3 = 5, 10 / 5 = 2, 20 - 2 = 18 and 18 * 3 = 54: SC_r = 54, a Number, as a division gives a number (Division page) and so does an operation with a number operand (Subtraction and Multiplication pages).
SC_r := ( SC_1 - SC_2 / (SC_3 + SC_4) ) * SC_5;
| SC_1 | SC_2 | SC_3 | SC_4 | SC_5 |
|---|---|---|---|---|
| 20 | 10 | 2 | 3 | 3 |
{
"scalars": [
{"name": "SC_1", "type": "Integer"},
{"name": "SC_2", "type": "Integer"},
{"name": "SC_3", "type": "Integer"},
{"name": "SC_4", "type": "Integer"},
{"name": "SC_5", "type": "Integer"}
]
}
{
"scalars": [
{"name": "SC_r", "type": "Number", "value": "54"}
]
}