Sub or Function - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Sub or Function (/Thread-Sub-or-Function) |
Sub or Function - mv8167 - 07-12-2011 In a Sub, should we be able to: Fax(rNum, C) or Fax(rNum, 1) or do I need to use a Function? RE: Sub or Function - rajpes - 07-12-2011 You can do everything in a sub that you could in a function EXCEPT that you cant return anything back. In your examples, If C is a variable, it works for both function and sub and i think neither function nor sub will work if you put some constant like '1' in arguments list which is absolutely of no use. RE: Sub or Function - mv8167 - 07-12-2011 Raj, Thx again for your help. For whatever reason, Fax(rNum, 1) will work as a Function but not as a Sub. passing anything back, but in a Sub, I keeping getting messages not wanting me to use ( ). But my call works Ok as a Function. For me, Fax(rNum, 1) or Fax(rNum, 0) works great. If my function gets a 0 then it runs all of the negvative tests. Since I only want these testzs run one time, when a 1 is passed, the negative tests qarec skipped. This saves a ton of execution time. thx for reading. RE: Sub or Function - rajpes - 07-12-2011 hmmm, may be but better coding standard is to use variable name Code: Function Fax(rNum,runStatus) RE: Sub or Function - mv8167 - 07-13-2011 I dont have gtalk. Sorry, but im scared of giving out my email address. I had a guy that started harassing me and the stalking me. To scary... sorry. |