Age Calculator
This program takes the persons birth year and the current year and calculates their age. It then works out their age if they were born 10 years earlier.
Program
---
Age Calculator Program Example
Uses the birth year and the current year to workout your age.
Then it subtracts 10 years from their birth year.
---
prog_vars =
d/name "Fred" -- name text var with default value
d/birth_year 1972 -- year of birth
d/current_year 2020 -- the current year
d/age 0 -- age in years
d/message1 "If you were born 10 years earlier"
prog_vars.
prog_start =
print " .......... "
print "Age Program Begin"
prog_start.
prog_loop =
-- Work Out their age
sub /current_year /birth_year -> /age
print "Hi /name you are /age years old"
-- Subtract 10 years from their birth year and recalc.
sub /birth_year 10 -> /birth_year
print "New birth year /birth_year"
-- Work Out their newage
sub /current_year /birth_year -> /age
-- Use /message1 to hold the message so the lines not too long.
print "/message1"
print "you would be /age years old"
print "Done exiting now!"
exitprog
prog_loop.
prog_stop =
exitprog
prog_stop.