Forum Discussion

msap's avatar
msap
Frequent Contributor
6 years ago

return function

what does return mean in this case?

I am trying to search a value from group of records in a grid and should match the OrderID(value from different grid)

if(equal(Grid.wValue(i,"Order ID"),OrderID))
return i;
return -1;

if I run this it doesnot show anything in message .I am not sure whther matching happening or not.

 

any suggestions please

2 Replies

  • cunderw's avatar
    cunderw
    Community Hero

    There is nothing in this code snippet that has a Log.Message so that makes sense that nothing is logging. 

     

    All this is is doing returning the value i (you have only provides a small section so I don't know what i is) if the equal comparison returns true, otherwise it's returning -1.

     

    Where are you calling this and what is the call doing with the return value?

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Check the following, specifically the "Function Return" section. 

     

    https://www.w3schools.com/js/js_functions.asp

     

    This is a basic coding keyword.  The function executes and then a value is returned based upon what is indicated in the "return" line.

    As mentioned in other questions from you, it would do you good to go take a tutorial on basic script coding languages like JavaScript.