I am learning Jython using a program called JES, and I am having trouble understanding how to return values from a function that can be used in another function.
For example:
def driver():
picture = makePicture(pickAFile())
input(picture)
changeRed(picture, reduceRedAmount)
def input(picture):
redReduceAmount = requestInteger("How much should I reduce red by?")
return redReduceAmount
def changeRed(picture, reduceRedAmount):
for p in getPixels(picture):
value=getRed(p)
setRed(p,value*0.9)
I want to be able to just run the driver function in the command area, and have that function include the other functions. I understand that results in functions are local and don't pass through, but I though that if you use 'return' then it stores that value for later use. Am I on the wrong track here? Surely there is a way to pass information between functions?