mirror of
https://gitlab.com/niansa/pilang2.git
synced 2025-03-06 20:49:22 +01:00
31 lines
1.5 KiB
Text
31 lines
1.5 KiB
Text
#This file is part of pilang.
|
|
#
|
|
#pilang is free software: you can redistribute it and/or modify
|
|
#it under the terms of the GNU General Public License as published by
|
|
#the Free Software Foundation, either version 3 of the License, or
|
|
#(at your option) any later version.
|
|
#
|
|
#pilang is distributed in the hope that it will be useful,
|
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
#GNU General Public License for more details.
|
|
#
|
|
#You should have received a copy of the GNU General Public License
|
|
#along with pilang. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
# 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 birth year,$input "Year of birth: "
|
|
cmp isnotnum,$~birth year,0,print $~errnonum,exit 3
|
|
set current year,$input "Current year: "
|
|
cmp isnotnum,$~current 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 ,$~birth year, and we are in ,$~current year,",", so I guess ,$~name, is ,$"sub asint,$~current year,$~birth year", years old!
|