Chinese zodiac: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 24:
 
Therefore 1984 was '''甲子''' (''jiă-zĭ'', or jia3-zi3). 2022 is '''壬寅''' (''rén-yín'' or ren2-yin2).
 
=={{header|11l}}==
{{trans|C++}}
 
<syntaxhighlight lang="11l">V animals = [‘Rat’, ‘Ox’, ‘Tiger’, ‘Rabbit’, ‘Dragon’, ‘Snake’, ‘Horse’, ‘Goat’, ‘Monkey’, ‘Rooster’, ‘Dog’, ‘Pig’]
V elements = [‘Wood’, ‘Fire’, ‘Earth’, ‘Metal’, ‘Water’]
 
Line 55 ⟶ 54:
2017 is the year of the Fire Rooster (yin).
</pre>
 
=={{header|360 Assembly}}==
{{trans|VBScript}}
<syntaxhighlight lang="text">* Chinese zodiac 10/03/2019
CHINEZOD CSECT
USING CHINEZOD,R13 base register
Line 135 ⟶ 133:
2017 is the year of the Fire Rooster (Yin ). 34/60
</pre>
 
=={{header|Action!}}==
<syntaxhighlight lang=Action"action!">DEFINE PTR="CARD"
 
PTR ARRAY animals(12),elements(5),stems(10),branches(12),yinYangs(2)
Line 214 ⟶ 211:
2021 xin-chou Metal Ox Yin 38/60
</pre>
 
=={{header|Ada}}==
{{works with|GNAT|8.3.0}}
 
<syntaxhighlight lang=Ada"ada">
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
Line 348 ⟶ 344:
2017 is the year of Fire Rooster (yin). 丁酉
</pre>
 
=={{header|ALGOL 68}}==
{{Trans|AWK}}
<syntaxhighlight lang="algol68">BEGIN # Chinese Zodiac #
# returns s right-padded with blanks to w characters, or s if s is already at least w characters long #
PRIO PAD = 1;
Line 386 ⟶ 381:
2017 Fire Rooster Yin
</pre>
 
=={{header|AppleScript}}==
{{Trans|JavaScript}}
{{Trans|Haskell}}
<syntaxhighlight lang=AppleScript"applescript">on run
-- TRADITIONAL STRINGS ---------------------------------------------------
Line 685 ⟶ 679:
dīngyŏu huǒ jī yīn
34/60 fire rooster </pre>
 
=={{header|AutoHotkey}}==
Chinese Animal/Element/Yin/Yang Characters Copied From "AppleScript"
<syntaxhighlight lang=AutoHotkey"autohotkey">Chinese_zodiac(year){
Animal := StrSplit("Rat,Ox,Tiger,Rabbit,Dragon,Snake,Horse,Goat,Monkey,Rooster,Dog,Pig", ",")
AnimalCh := StrSplit("鼠牛虎兔龍蛇馬羊猴鸡狗豬")
Line 715 ⟶ 708:
return year "`t" S B " " Sn "-" Bn " `t" E " " Ec " " En "`t" A " " Ac " " An "`t" YY " " Yr
}</syntaxhighlight>
Examples:<syntaxhighlight lang=AutoHotkey"autohotkey">loop 12
{
n := 1983+A_Index
Line 737 ⟶ 730:
 
2017 丁酉 dīng-yŏu Fire 火 huǒ Rooster 鸡 jī yīn 阴 34/60</pre>
 
=={{header|AWK}}==
<syntaxhighlight lang=AWK"awk">
# syntax: GAWK -f CHINESE_ZODIAC.AWK
BEGIN {
Line 768 ⟶ 760:
2017 Fire Rooster Yin
</pre>
 
=={{header|BASIC256}}==
<syntaxhighlight lang=BASIC256"basic256">
# Chinese zodiac
 
Line 806 ⟶ 797:
2017: 丁酉 (dīng-yŏu, Fire Rooster; Yin - ciclo 34/60)
</pre>
 
=={{header|Befunge}}==
 
<syntaxhighlight lang="befunge">0" :raeY">:#,_55+"< /8"&>+:66+%00p:55+v
v"Aspect: "0++88*5%2\0\+1%"<":p01++66/2%<
>00g5g7-0" :laminA"10g5g"<"+0" :tnemelE"v
Line 825 ⟶ 815:
Aspect: yang
Cycle: 35 / 60</pre>
 
=={{header|C}}==
{{trans|C++}}
<syntaxhighlight lang="c">#include <math.h>
#include <stdio.h>
 
Line 870 ⟶ 859:
1976 is the year of the Fire Dragon (yang).
2017 is the year of the Fire Rooster (yin).</pre>
 
=={{header|C sharp|C#}}==
{{trans|Java}}
<syntaxhighlight lang="csharp">using System;
 
namespace ChineseZodiac {
Line 909 ⟶ 897:
1985 is the year of the Wood Ox (yin). 乙丑
2017 is the year of the Fire Rooster (yin). 丁酉</pre>
 
=={{header|C++}}==
<syntaxhighlight lang="cpp">#include <iostream>
#include <cmath>
 
Line 961 ⟶ 948:
2017 is the year of the Fire Rooster (yin).
</pre>
 
=={{header|Clojure}}==
<syntaxhighlight lang="clojure">(def base-year 4)
(def celestial-stems ["甲" "乙" "丙" "丁" "戊" "己" "庚" "辛" "壬" "癸"])
(def terrestrial-branches ["子" "丑" "寅" "卯" "辰" "巳" "午" "未" "申" "酉" "戌" "亥"])
Line 1,005 ⟶ 991:
2017: 丁酉 (dīng-yŏu, Fire Rooster; yin - cycle 34/60)
</pre>
 
=={{header|Commodore BASIC}}==
{{works with|Commodore 64/128}}
<syntaxhighlight lang="basic">1000 rem display the chinese zodiac for a given year
1010 poke 53281,7: rem yellow background
1020 poke 53280,2: rem red border
Line 1,081 ⟶ 1,066:
{{Out}}
https://i.imgur.com/f3Fo1xm.png
 
=={{header|Common Lisp}}==
{{trans|Ruby}}
<syntaxhighlight lang="lisp">; Any CE Year that was the first of a 60-year cycle
(defconstant base-year 1984)
 
Line 1,153 ⟶ 1,137:
1976: 丙辰 (bĭng-chén, Fire Dragon; yang)
</pre>
 
=={{header|D}}==
{{trans|haskell}}
<syntaxhighlight lang=D"d">import std.stdio;
 
// 10 heavenly stems
Line 1,248 ⟶ 1,231:
{{libheader| System.Math}}
{{Trans|C#}}
<syntaxhighlight lang=Delphi"delphi">
program Chinese_zodiac;
 
Line 1,347 ⟶ 1,330:
1985 is the year of the Wood Ox (yin). 乙丑
2017 is the year of the Fire Rooster (yin). 丁酉</pre>
 
=={{header|Excel}}==
===LAMBDA===
Line 1,356 ⟶ 1,338:
 
{{Works with|Office 365 betas 2021}}
<syntaxhighlight lang="lisp">CNZODIAC
=LAMBDA(y,
APPENDCOLS(
Line 1,499 ⟶ 1,481:
and also assuming the following generic bindings in the Name Manager for the WorkBook:
 
<syntaxhighlight lang="lisp">APPENDCOLS
=LAMBDA(xs,
LAMBDA(ys,
Line 1,752 ⟶ 1,734:
| style="text-align:center" | bright
|}
 
=={{header|F Sharp|F#}}==
<syntaxhighlight lang="fsharp">
open System
 
Line 1,788 ⟶ 1,769:
2017 is the year of the Fire Rooster (Yin)
</pre>
 
=={{header|Factor}}==
<syntaxhighlight lang="factor">USING: circular formatting io kernel math qw sequences
sequences.repeating ;
IN: rosetta-code.zodiac
Line 1,832 ⟶ 1,812:
2017 is the year of the Fire Rooster (yin).
</pre>
 
=={{header|FreeBASIC}}==
<syntaxhighlight lang="freebasic">dim as string yy(0 to 1) = {"yang", "yin"}
dim as string elements(0 to 4) = {"Wood", "Fire", "Earth", "Metal", "Water"}
dim as string animals(0 to 11) = {"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake",_
Line 1,860 ⟶ 1,839:
2186 is the year of the Earth Dog (yang).
76543 is the year of the Water Rabbit (yin).</pre>
 
=={{header|Fōrmulæ}}==
 
Line 1,868 ⟶ 1,846:
 
In '''[https://formulae.org/?example=Chinese_zodiac this]''' page you can see the program(s) related to this task and their results.
 
=={{header|Go}}==
<syntaxhighlight lang="go">package main
 
import "fmt"
Line 1,909 ⟶ 1,886:
1976: Fire Dragon, Yang, Cycle year 53 丙辰
</pre>
 
=={{header|Groovy}}==
{{trans|Java}}
<syntaxhighlight lang="groovy">class Zodiac {
final static String[] animals = ["Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"]
final static String[] elements = ["Wood", "Fire", "Earth", "Metal", "Water"]
Line 1,942 ⟶ 1,918:
1985 is the year of the Wood Ox (yin). 乙丑
2017 is the year of the Fire Rooster (yin). 丁酉</pre>
 
=={{header|Haskell}}==
(We can use Chinese characters in Haskell names, as long as the first character is lower-case alphabetic)
<syntaxhighlight lang="haskell">import Data.Array (Array, listArray, (!))
 
------------------- TRADITIONAL STRINGS ------------------
Line 2,077 ⟶ 2,052:
dīngyŏu huǒ jī yīn
34/60 fire rooster </pre>
 
=={{header|J}}==
<syntaxhighlight lang=J"j"> ELEMENTS=: _4 |. 2 # ;:'Wood Fire Earth Metal Water'
YEARS=: 1935 1938 1968 1972 1976 2017
 
Line 2,121 ⟶ 2,095:
2017 丁 酉 ( yin )
</syntaxhighlight>
 
=={{header|Java}}==
<syntaxhighlight lang=Java"java">public class Zodiac {
 
final static String animals[]={"Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig"};
Line 2,163 ⟶ 2,136:
2017 is the year of the Fire Rooster (yin). 丁酉
</pre>
 
=={{header|JavaScript}}==
 
===ES6===
{{Trans|Haskell}}
<syntaxhighlight lang=JavaScript"javascript">(() => {
"use strict";
 
Line 2,383 ⟶ 2,355:
rényín shuǐ hǔ yáng
39/60 water tiger </pre>
 
=={{header|Julia}}==
{{works with|Julia|0.6}}
{{trans|Python}}
 
<syntaxhighlight lang="julia">function chinese(year::Int)
pinyin = Dict(
"甲" => "jiă",
Line 2,454 ⟶ 2,425:
1976: 丙辰 (bĭng-chén, Fire Dragon; yang - year 53 of the cycle)
2018: 戊戌 (wù-xū, Earth Dog; yang - year 35 of the cycle)</pre>
 
=={{header|Kotlin}}==
<syntaxhighlight lang="scala">// version 1.1.2
 
class ChineseZodiac(val year: Int) {
Line 2,517 ⟶ 2,487:
2017 丁酉 dīng-yŏu Fire Rooster Yin 34/60
</pre>
 
=={{header|Lua}}==
{{trans|C}}
<syntaxhighlight lang="lua">local ANIMALS = {"Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig"}
local ELEMENTS = {"Wood","Fire","Earth","Metal","Water"}
 
Line 2,561 ⟶ 2,530:
1976 is the year of the Fire Dragon (yang)
2017 is the year of the Fire Rooster (yin)</pre>
 
=={{header|Maple}}==
<syntaxhighlight lang=Maple"maple">
zodiac:=proc(year::integer)
local year60,yinyang,animal,element;
Line 2,573 ⟶ 2,541:
end proc:
</syntaxhighlight>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<syntaxhighlight lang=Mathematica"mathematica">pinyin = <|"甲" -> "jiă", "乙" -> "yĭ", "丙" -> "bĭng", "丁" -> "dīng",
"戊" -> "wù", "己" -> "jĭ", "庚" -> "gēng", "辛" -> "xīn",
"壬" -> "rén", "癸" -> "gŭi", "子" -> "zĭ", "丑" -> "chŏu",
Line 2,622 ⟶ 2,589:
1972: 壬子 (rén-zĭ, Water Rat; yang)
1976: 丙辰 (bĭng-chén, Fire Dragon; yang)</pre>
 
=={{header|Modula-2}}==
{{trans|C++}}
<syntaxhighlight lang="modula2">MODULE ChineseZodiac;
FROM FormatString IMPORT FormatString;
FROM Terminal IMPORT WriteString,ReadChar;
Line 2,678 ⟶ 2,644:
ReadChar
END ChineseZodiac.</syntaxhighlight>
 
=={{header|Nim}}==
{{trans|Rust}}
<syntaxhighlight lang="nim">import strformat
 
const ANIMALS: array[12, string] = ["Rat", "Ox",
Line 2,740 ⟶ 2,705:
2020 庚子 gēng-zĭ Metal Rat Yang 37/60
</pre>
 
=={{header|Pascal}}==
{{works with|Extended Pascal}}
The built-in functions <tt>pred</tt> and <tt>succ</tt> accepting a second (optional) parameter is an Extended Pascal (ISO 10206) extension, as well as the possibility of specifying <tt>record</tt> literals.
<syntaxhighlight lang="pascal">type
animalCycle = (rat, ox, tiger, rabbit, dragon, snake,
horse, goat, monkey, rooster, dog, pig);
Line 2,765 ⟶ 2,729:
]
end;</syntaxhighlight>
 
=={{header|Perl}}==
<syntaxhighlight lang="perl">sub zodiac {
my $year = shift;
my @animals = qw/Rat Ox Tiger Rabbit Dragon Snake Horse Goat Monkey Rooster Dog Pig/;
Line 2,797 ⟶ 2,760:
2017: 丁酉 (dīng-yŏu) Fire Rooster; yin - year 34 of the cycle
</pre>
 
=={{header|Phix}}==
<!--<syntaxhighlight lang=Phix"phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">animals</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #008000;">"Rat"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Ox"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Tiger"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Rabbit"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Dragon"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Snake"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Horse"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Goat"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Monkey"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Rooster"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Dog"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Pig"</span><span style="color: #0000FF;">},</span>
Line 2,825 ⟶ 2,787:
2018: Earth Dog; yang, year 35 of the cycle.
</pre>
 
=={{header|Picat}}==
{{trans|Prolog}}
{{works with|Picat}}
<syntaxhighlight lang=Picat"picat">
animals({"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"}).
 
Line 2,887 ⟶ 2,848:
2017 is the year of the Fire Rooster (yin). 丁酉
</pre>
 
=={{header|PowerShell}}==
{{trans|Ruby}}
<syntaxhighlight lang=PowerShell"powershell">
function Get-ChineseZodiac
{
Line 2,977 ⟶ 2,937:
}
</syntaxhighlight>
<syntaxhighlight lang=PowerShell"powershell">
1935, 1938, 1968, 1972, 1976 | Get-ChineseZodiac | Format-Table
</syntaxhighlight>
Line 2,991 ⟶ 2,951:
</pre>
Defaults to the current year:
<syntaxhighlight lang=PowerShell"powershell">
Get-ChineseZodiac
</syntaxhighlight>
Line 3,005 ⟶ 2,965:
</pre>
Using the '''Year''' property of a <code>[DateTime]</code> object:
<syntaxhighlight lang=PowerShell"powershell">
Get-Date "11/8/2016" | Get-ChineseZodiac
</syntaxhighlight>
Line 3,019 ⟶ 2,979:
</pre>
Emulate the Ruby script's output:
<syntaxhighlight lang=PowerShell"powershell">
$zodiacs = 1935, 1938, 1968, 1972, 1976 | Get-ChineseZodiac
 
Line 3,041 ⟶ 3,001:
1976: 丙辰 (bĭng-chén, Fire Dragon; yang - year 53 of the cycle)
</pre>
 
=={{header|Prolog}}==
{{trans|Java}}
{{works with|GNU Prolog}}
<syntaxhighlight lang=Prolog"prolog">
:- initialization(main).
 
Line 3,116 ⟶ 3,075:
2017 is the year of the Fire Rooster (yin). 丁酉
</pre>
 
=={{header|PureBasic}}==
<syntaxhighlight lang=pureBasic"purebasic">EnableExplicit
#BASE=4
#SPC=Chr(32)
Line 3,179 ⟶ 3,137:
1984 Wood Rat yang 1 jiă-zĭ 甲子
2017 Fire Rooster yin 34 dīng-yŏu 丁酉</pre>
 
=={{header|Python}}==
{{trans|Ruby}}
<syntaxhighlight lang=Python"python">
# coding: utf-8
 
Line 3,252 ⟶ 3,209:
Or, segmenting tokens just in time, and writing out wiki tables:
{{Works with|Python|3.7}}
<syntaxhighlight lang="python">'''Chinese zodiac'''
 
from functools import (reduce)
Line 3,556 ⟶ 3,513:
|dark
|}
 
=={{header|Racket}}==
{{trans|Common Lisp}}
 
<syntaxhighlight lang="racket">#lang racket
 
(require racket/date)
Line 3,615 ⟶ 3,571:
1972: 壬子 (rén-zĭ, Water Rat; yang)
1976: 丙辰 (bĭng-chén, Fire Dragon; yang)</pre>
 
=={{header|Raku}}==
(formerly Perl 6)
Line 3,621 ⟶ 3,576:
{{trans|Ruby}}
 
<syntaxhighlight lang="raku" line>sub Chinese-zodiac ( Int $year ) {
my @heaven = <甲 jiă 乙 yĭ 丙 bĭng 丁 dīng 戊 wù 己 jĭ 庚 gēng 辛 xīn 壬 rén 癸 gŭi>.pairup;
my @earth = <子 zĭ 丑 chŏu 寅 yín 卯 măo 辰 chén 巳 sì 午 wŭ 未 wèi 申 shēn 酉 yŏu 戌 xū 亥 hài>.pairup;
Line 3,658 ⟶ 3,613:
1984: 甲子 (jiăzĭ, Wood Rat; yang - year 1 in the cycle)
2017: 丁酉 (dīngyŏu, Fire Rooster; yin - year 34 in the cycle)</pre>
 
=={{header|Ring}}==
<syntaxhighlight lang="ring">
yinyang = ["yang", "yin"]
elements = ["Wood", "Fire", "Earth", "Metal", "Water"]
Line 3,686 ⟶ 3,640:
76543 is the year of the Water Rabbit (yin).
</pre>
 
=={{header|Ruby}}==
This is written as a command-line tool that takes a list of CE year numbers as arguments and outputs their information; if no arguments are supplied, it displays the information for the current year.
 
<syntaxhighlight lang="ruby"># encoding: utf-8
pinyin = {
'甲' => 'jiă',
Line 3,767 ⟶ 3,720:
Given no arguments and run during the year 2017:
<pre>丁酉 (dīng-yŏu, Fire Rooster; yin - year 34 of the cycle)</pre>
 
=={{header|Rust}}==
{{trans|Kotlin}}
<syntaxhighlight lang=Rust"rust">fn chinese_zodiac(year: usize) -> String {
static ANIMALS: [&str; 12] = [
"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake",
Line 3,835 ⟶ 3,787:
1984 甲子 jiă-zĭ Wood Rat Yang 01/60
2017 丁酉 dīng-yŏu Fire Rooster Yin 34/60</pre>
 
=={{header|Scala}}==
<syntaxhighlight lang=Scala"scala">object Zodiac extends App {
val years = Seq(1935, 1938, 1968, 1972, 1976, 1984, 1985, 2017, 2018)
 
Line 3,874 ⟶ 3,825:
}</syntaxhighlight>
{{Out}}See it in running in your browser by [https://scalafiddle.io/sf/O6MUr27/0 ScalaFiddle (JavaScript)] or by [https://scastie.scala-lang.org/KXC0j71ORFaQxNZSCCZ1Aw Scastie (JVM)].
 
=={{header|Seed7}}==
The standard output file of Seed7 accepts only Latin-1 (byte) output.
Line 3,881 ⟶ 3,831:
The library [http://seed7.sourceforge.net/libraries/console.htm console.s7i] defines STD_CONSOLE.
 
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i";
include "console.s7i";
 
Line 3,915 ⟶ 3,865:
2017 is the year of the Fire Rooster (yin). 丁酉
</pre>
 
=={{header|Sidef}}==
{{trans|Perl}}
<syntaxhighlight lang="ruby">func zodiac(year) {
var animals = %w(Rat Ox Tiger Rabbit Dragon Snake Horse Goat Monkey Rooster Dog Pig)
var elements = %w(Wood Fire Earth Metal Water)
Line 3,948 ⟶ 3,897:
2017: 丁酉 (dīng-yŏu) Fire Rooster; yin - year 34 of the cycle
</pre>
 
=={{header|tbas}}==
<syntaxhighlight lang="qbasic">
DATA "甲","乙","丙","丁","戊","己","庚","辛","壬","癸"
DECLARE celestial$(10)
Line 4,035 ⟶ 3,983:
 
</pre>
 
=={{header|Tcl}}==
<syntaxhighlight lang=Tcl"tcl">
proc cn_zodiac year {
set year0 [expr $year-4]
Line 4,061 ⟶ 4,008:
丁酉 ding1-you3 Fire Rooster (yin) year 34
</pre>
 
=={{header|uBasic/4tH}}==
{{works with|R3}}
<syntaxhighlight lang="text">dim @y(2) ' yin or yang
dim @e(5) ' the elements
dim @a(12) ' the animals
Line 4,108 ⟶ 4,054:
0 OK, 0:1047
</pre>
 
=={{header|UNIX Shell}}==
{{works with|Bash|4+}}
Line 4,269 ⟶ 4,214:
1972:壬子(rén-zĭ, Water Rat; yang)
1976:丙辰(bĭng-chén, Fire Dragon; yang)</pre>
 
=={{header|UTFool}}==
 
<syntaxhighlight lang=UTFool"utfool">
···
http://rosettacode.org/wiki/Chinese_zodiac
Line 4,313 ⟶ 4,257:
wuxing[2][stem / 2], shengxiao[2][branch]
</syntaxhighlight>
 
=={{header|VBScript}}==
To run in console mode with cscript.
<syntaxhighlight lang="vb">' Chinese zodiac - VBS
 
Animals = array( "Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig" )
Line 4,342 ⟶ 4,285:
2017 is the year of the Fire Rooster (Yin).
</pre>
 
=={{header|Visual Basic .NET}}==
{{trans|C#}}
<syntaxhighlight lang="vbnet">Module Module1
 
ReadOnly ANIMALS As String() = {"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"}
Line 4,385 ⟶ 4,327:
1985 is the year of the Wood Ox (yin). 乙丑
2017 is the year of the Fire Rooster (yin). 丁酉</pre>
 
=={{header|Vlang}}==
{{trans|Go}}
<syntaxhighlight lang="vlang">const (
animal_string = ["Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake",
"Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"]
Line 4,419 ⟶ 4,360:
Same as Go entry
</pre>
 
=={{header|Wren}}==
{{trans|Kotlin}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt
 
class ChineseZodiac {
Line 4,481 ⟶ 4,421:
2020 庚子 gēng-zĭ Metal Rat Yang 37/60
</pre>
 
 
=={{header|Yabasic}}==
<syntaxhighlight lang=Yabasic"yabasic">
dim Animals$(12) : for a = 0 to 11 : read Animals$(a) : next a
dim Elements$(5) : for a = 0 to 4 : read Elements$(a): next a
Line 4,516 ⟶ 4,454:
2017 is the year of the Fire Rooster (Yin).
</pre>
 
 
=={{header|zkl}}==
{{trans|Ruby}}
<syntaxhighlight lang="zkl">fcn ceToChineseZodiac(ce_year){ // --> list of strings
# encoding: utf-8
var [const] pinyin=SD( // create some static variables, SD is small fixed dictionary
Line 4,552 ⟶ 4,488:
stem_pinyin,branch_pinyin, element,animal,aspect)
}</syntaxhighlight>
<syntaxhighlight lang="zkl">foreach ce_year in (T(1935,1938,1968,1972,1976,Time.Clock.UTC[0])){
println("%d: %s%s (%s-%s, %s %s; %s)"
.fmt(ce_year,ceToChineseZodiac(ce_year).xplode()));