Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Created by: James Sanii
- # Created on: Sep 2016
- # Created for: ICS3U
- # This program shows the difference between local and global variables
- import ui
- variableX = 25
- def local_button_touch_up_inside(sender):
- # shows what happen with local variable
- variableX = 10
- variableY = 30
- variableZ = variableX + variableY
- view['local_answer_label'].text = str(variableZ)
- def global_button_touch_up_inside(sender):
- # shows what happen with global variable
- #global variableX
- #variableX = variableX + 1
- variableY = 30
- variableZ = variableX + variableY
- view['global_answer_label'].text = str(variableZ)
- view = ui.load_view()
- view.present('full_screen')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement