RosettaCodeData/Task/Chinese-zodiac/FutureBasic/chinese-zodiac.basic

22 lines
588 B
Text
Raw Permalink Normal View History

2024-11-04 20:28:54 -08:00
void local fn DoIt
CFArrayRef yy = @[@"yang",@"yin"]
CFArrayRef elements = @[@"Wood",@"Fire",@"Earth",@"Metal",@"Water"]
CFArrayRef animals = @[@"Rat",@"Ox",@"Tiger",@"Rabbit",@"Dragon",
@"Snake",@"Horse",@"Goat",@"Monkey",@"Rooster",@"Dog",@"Pig"]
long yr, y, e, a, i, tests(5) = {1801,1861,1984,2020,2186,76543}
CFStringRef outstr
for i = 0 to 5
yr = tests(i)
y = yr % 2
e = (yr-4) % 5
a = (yr-4) %12
outstr = concat(@"",@(yr),@" is the year of the ",elements[e],@" ",animals[a],@" (",yy[y],@")")
print outstr
next
end fn
fn DoIt
HandleEvents