fork(3) download
  1. def printcake():
  2. print cake #This function prints the taste of cake when called
  3. def setcake(taste, printq):
  4. global cake #This makes sure that cake can be called in any function
  5. cake = taste #sets cake's taste
  6. if printq: #determines whether to print the taste
  7. printcake()
  8. setcake('good', True) #Calls the function to set cake. Tells it to print result. The output is good
Success #stdin #stdout 0.08s 8832KB
stdin
Standard input is empty
stdout
good