1
0
Fork 0
mirror of https://gitlab.com/niansa/pilang.git synced 2025-03-06 20:48:26 +01:00
pilang/test.pil
2020-04-09 23:44:06 +02:00

16 lines
868 B
Text

# Enable error catching
catch True
# Initialise stuff
set wasword,was
# Get input from user
set errnonum,Whatever you typed in... It's definitely not a number!!!
set name,$input "Name: "
cmp equal,$~name,,"print What? That person has no name???",exit 1
set current year,$input "Current year: "
cmp isnotnum,$~current year,0,print $~errnonum,exit 2
set birth year,$input "Year of birth: "
cmp isnotnum,$~birth year,0,print $~errnonum,exit 3
# Check if birth year is before current year
cmp smaller,$~current year,$~birth year,"print Will ,$~name, be born in the future?","set yesno,$input Yes/No?: ","cmp equal,$lower $~yesno,no,exit 4","cmp nonequal,$lower $~yesno,yes,print I give you up... Bye!,exit 4","set wasword,will be"
# Print result
print $~name, ,$~wasword, born in ,$~current year,",", so I guess he is ,$"sub asint,$~current year,$~birth year", Years old!