Anonymous user
User input/Graphical: Difference between revisions
→{{header|Processing Python mode}}: int conversion fail-safe
(add task to ARM64 assembly Raspberry Pi) |
(→{{header|Processing Python mode}}: int conversion fail-safe) |
||
Line 2,563:
<lang Python>from javax.swing import JOptionPane
def to_int(n, default=0):
try:
number = int(JOptionPane.showInputDialog ("Enter an Integer")) ▼
return
except ValueError:
return default
string = JOptionPane.showInputDialog ("Enter a String")</lang>
|