forked from upizpp/PhiScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Input
gene-2012 edited this page Jan 6, 2024
·
1 revision
Similar to io.print(), you must import the io module first. There are only two ways to input values in PhiScript.
import io;
var x = io.input(<prompt>);
import io;
var x = io.input("Whats your name?");
io.print(x);
import io;
var x = io.get_number(<prompt>, <output after input a invalid number>);
io.get_number() is similar to this Python code:
while(True):
try:
x = int(input("<prompt>"))
break
except ValueError:
print("<output after input a invalid number>")import io;
var x = io.input("How old are you:", "Invalid input:");
io.print(x);