Sign in to follow this  
Followers 0
IvanCodin

Function calls function

3 posts in this topic

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

Share this post


Link to post
Share on other sites



Really only a function is useful if you will call it more then once

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0