# How do i Write Exp if the Operator is a Variable

0 favourites
• 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
• Variable a = 5

Variable b = 5

Variable c = "+"

Variable d = +

Variable f = Variable a Variable c Variable b

answer is 10 how do i write the above formula

or

Variable f = Variable a Variable d Variable b

answer is 10 how do i write the above formula

it is simple but i cant solve i know how to write var a + var b = 10 but how to write it when the operator is also a variable?

• Because variable c and variable d are not values but strings(texts) you couldn't do it directly..

To calculate the value variable f

You should first check the variable d:

System compare variable d = "+"

• set variable f = variable a + variable b

System compare variable d = "-"

• set variable f = variable a - variable b

System compare variable d = "x"

• set variable f = variable a * variable b

System compare variable d = ":"

• set variable f = variable a / variable b
• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• LittleStain thanks i did not know var operator can only be string

• 3 posts
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)