Simple math with variables?

PHaRTnONu

Client
Регистрация
01.10.2016
Сообщения
340
Благодарностей
48
Баллы
28
How can I do simple math with variables?
I wanted to do a switch but it doesn't seem to work correctly.
 

zortexx

Client
Регистрация
19.09.2011
Сообщения
2 520
Благодарностей
1 223
Баллы
113
You can use if.
For example:
Код:
'{-Variable.Example-}'=='Something'
But you should do the correct comparing by right type of data.
 

PHaRTnONu

Client
Регистрация
01.10.2016
Сообщения
340
Благодарностей
48
Баллы
28
.... switch wont work with >= aurguments.....
this is why i asked about mathmatical forulas
 

zortexx

Client
Регистрация
19.09.2011
Сообщения
2 520
Благодарностей
1 223
Баллы
113

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
524
Благодарностей
112
Баллы
43
To do 3+2 = 5 you must use java or c# :S
 

sMax

Client
Регистрация
04.05.2011
Сообщения
132
Благодарностей
49
Баллы
28
@PHaRTnONu
For a simple multiplication,
You could do something like

Simplemath.JPG


using variables from a template, and placing the result back into a template variable.

Код:
double frst = Convert.ToDouble(project.Variables["first"].Value);
double scnd = Convert.ToDouble(project.Variables["second"].Value);

return frst * scnd;
Change the '*' to '+','-' or '/' as needed
Use a variable parser (example double.Parse) if you have decimal places.

Hope that helps
 
Последнее редактирование:
  • Спасибо
Реакции: PHaRTnONu

PHaRTnONu

Client
Регистрация
01.10.2016
Сообщения
340
Благодарностей
48
Баллы
28
hel;ped a ton thanks i needed this again recently
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)