Jump to content

Function calls function


 Share

Recommended Posts

I am new to programming and often struggle with call flows in scripts. The question I have is this ....

Is it good programming practice for a function to call another function or should this be avoided. I always get stuck when trying to figure out the flow of script errors. I do understand functions run and return results or do specified things. What I struggle with is when I want to check the users input should I do it in the function or test all of the inputs after they have been entered by the user.

What is you learned opinions???

Thanks

CC

Link to comment
Share on other sites

I am new to programming and often struggle with call flows in scripts. The question I have is this ....

Is it good programming practice for a function to call another function or should this be avoided. I always get stuck when trying to figure out the flow of script errors. I do understand functions run and return results or do specified things. What I struggle with is when I want to check the users input should I do it in the function or test all of the inputs after they have been entered by the user.

What is you learned opinions???

Thanks

CC

No learned opinion here, but functions calling other functions is normal and healthy in a well-coded script. As for your specific example, if you only have to code the check once in a particular function, there is no reason to break it out into a separate function. As soon as you find yourself typing the same check in again anywhere else, it's time to put it in a function of its own.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...