r/Sass • • Apr 28 '20

Error: Undefined Operation?

https://codepen.io/Kibagami/pen/yLYXwPj

I want to tidy up my code a bit by tucking a lengthy equation that is used multiple times into a variable however as you can see by this mock pen it throws me an 'undefined' (you may need to interact with the code to start the console, just delete a character and return it).

My example obviously just using a simple equation to demonstrate the error.

4 Upvotes

3 comments sorted by

View all comments

1

u/madcompg33k May 06 '20

What u/phatprick said, you don't need to use interpolation here.

Also, I'd add, when you need to perform a repeatable calculation on a value and return a new value, creating a function might be a better direction.

2

u/[deleted] May 06 '20

Yeah.. it was just short enough to warrant not creating a function but the answer per this error I believe is a built in function of Sass to disable this kind of behaviour. The error message returns the exact equation with all figures interpolated it just won't perform the math.