Double.TryParse(InputValue,0) explanation

I am unable to understand what that (0) stands for within double.TryParse brackets.
This is from academy

Thank you in advance

@Vidya_Srinivasan - its a signature of the
Double.TryParse(input string , output double).

pls refer below link

3 Likes

This doesn’t answer it for me. Perhaps you can elaborate. The .NET link you provided specifies that the second argument (double) TryParse(String, Double) has to be variable and gives out an error when set to 0.

TryParse only verifies if the input is a valid string containing double value. A TRUE means it is valid and FALSE means otherwise.
For example,
var_double double

double.TryParse( “12.34”, var_double) will return TRUE
double.TryParse( “12.34a”, var_double) will return FALSE

After evaluating the outcome you should then do the actual “parse” to get the value. Thus, if
strVAlue=“12.34” then the following code evaluates if the outcome is true and if yes, then converts the string value into double and stores it into a double variable. If false, then it prints a message:

if double.TryParse( strValue, var_double ) then (…do the parse)
var_double = double.Parse(strValue)
write line (strVAlue+" IS a double. var_double = “+var_double.ToString)
else
write line (strVAlue+” is NOT a double")

Hope this helps.

That is not quite accurate. Double.TryParse is basically Double.Parse but wrapped in a Try-Catch.

See: https://docs.microsoft.com/en-us/dotnet/api/system.double.tryparse?view=net-5.0

Double.TryParse performs the conversion as well as returns TRUE or FALSE based on the results of the conversion. There is no need to redo the conversion using Parse. The second parameter is to hold the converted value.

For the OP, I would wager that UiPath academy is only trying to determine if the string value being converted is a double precision number. The 0 signifies a null value and thus disregards the converted value.