Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Sorry for all the posts. I have run into a problem. This stems back to my novice programming experience... My question is, how do I pass in an argument to a function only sometimes, only when a condition is true. Here is an example...
#call the function----------------------------
if checkbox == True:
Function1(x, y, z)
else:
Function1(x,y)
#define the function-----------------------
def Function1(x,y,z) <----- Problem! variable z is only present when checkbox is TRUE.
Thus, i get an error. How do i define the function to only pass in the variable 'Z' when the checkbox is true? Sorry, I am still inexperienced in programming.
Thanks!
Solved! Go to Solution.