Simple math with variables?

  • Автор темы Автор темы PHaRTnONu
  • Дата начала Дата начала

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.
 
You can use if.
For example:
Код:
Развернуть Свернуть Копировать
'{-Variable.Example-}'=='Something'

But you should do the correct comparing by right type of data.
 
.... switch wont work with >= aurguments.....
this is why i asked about mathmatical forulas
 
To do 3+2 = 5 you must use java or c# :S
 
@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
hel;ped a ton thanks i needed this again recently
 

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