calculation syntax

Katana

Client
Регистрация
28.03.2021
Сообщения
80
Благодарностей
7
Баллы
8
Hello everyone,
if i want to create a c # module which computes values between it and then create output value in zenno how can i do that?
I know the resulting value is a "string" so I have to convert it to "int"
so the code will give this style?

var number1 = int.TryParse ("project.Variables [" number_photos "]. Value", out number),
var number2 = int.TryParse ("project.Variables [" number_regex "]. Value", out number),
var result = number1 / number2
return result


is the code correct? and will the "result" variable be created automatically in zenno?
first time c# in zenno

thanks for your advices
 

Phoenix78

Client
Read only
Регистрация
06.11.2018
Сообщения
11 790
Благодарностей
5 683
Баллы
113
C#:
double number1=0;
double number2=0;
double result=0;
double.TryParse(project.Variables["var_number_photos"].Value, out number1);
double.TryParse (project.Variables["var_number_regex"].Value, out number2);
if (number2 !=0) result = (double) (number1 / number2);
return result;
87501
 
  • Спасибо
Реакции: Katana

Katana

Client
Регистрация
28.03.2021
Сообщения
80
Благодарностей
7
Баллы
8

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