Need help converting this equation into Thunkable Blocks

I am currently trying to create a block that contains a math equation. The problem is I do not know how to convert the equation below into blocks.

monthlyPayment = (loanAmount - downPayment + (loanAmount * (interestRate / 100) * loanTerm)) / loanTerm

What have you tried? Post a link to a project with blocks you’ve attempted and someone can suggest a fix. You’ll need a variable for each item (for example, loanAmount).

1 Like

This is the best that I’ve tried.

That’s hard to check carefully and you didn’t post a link to the project so I can’t make changes for you.

Here’s what I would suggest:

  1. Separate out parts of the equation. So if your equation was, say, y=(2x-3)/2… then you could set a variable called numerator to 2x-3 and set a variable called denominator to 2 and then set a variable called y to numerator ÷ denominator. Pulling the equation apart like that can make debugging it very simple.

  2. This is more of an aside but… stored variables are slow in Thunkable. I recommend – if speed matters at all here – to use app variables and only use stored variables when setting/changing a variable’s value. So when the screen opens, you would set each app variable to its stored variable partner and then use app variables throughout your blocks. When setting the final value of the equation, you would want to use a stored variable at that point.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.