Thanks for reaching out on Microsoft Q&A!
Please check in code view whether your value is noted as "@{variables('var')}", and if that is the case change it to "@variables('var')" (so without the curly brackets) as the first notation interprets any value as string and the second casts the value to it’s original form. This is not only the case with integers though, the same goes for boolean values.
Please click ‘Accept answer’ if you think my answer is helpful. Feel free to drop additional queries in the comments below!
Kind regards,
Sonny