Forum Discussion

Daniellovesmith's avatar
Daniellovesmith
Contributor
6 years ago

calling two functions in a single line of code?

Question: I want to call functions from a single point.

 

Ex:

 

1.

Function Test1()

{

}

 

2.

Function Test2()

{

}

 

  • I need to call the above two functions in single point or single line of code.

 

How do we handle this kind of scripting?

6 Replies

  • shankar_r's avatar
    shankar_r
    Community Hero

    The question does not make sense, Why you want to call two functions in single line?

    • Daniellovesmith's avatar
      Daniellovesmith
      Contributor

      Yes, I know but it is req from the client. In test complete we can import functions from unit 1 to unit 2 and call them , that's easy, Client not statisfied with that. Can we use Onclick event to call two fucntions ? for example in javascript.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        Still not sure about actual problem and use case that caused it. Can you describe it with more details?
        The simple and obvious solution is to create a third function that will call required two ones and call this function. Technically it will be one-liner.
        But something tells me that this is not what you are looking for.
        (If you are looking for concurrent code execution (like calling different functions from two different threads), then this is not possible in scripting languages.)

         

  • SushantNfl's avatar
    SushantNfl
    Occasional Contributor

    Can you be more specific like exactly what you want to do?

    Calling multiple functions in a single line makes sense when all the methods return some value and combined output is required for further processing.

     

    If you can provide more details on the question(like the use of methods,need of calling 2 functions in the same line), that will be better.

     

    Thanks,

    Sushant