[REBOL] Re: DyBASE test
From: AJMartin:orcon at: 24-Jan-2004 11:41
Sunanda wrote:
> A line of code like:
>
> print if either or and but
>
> may be completely valid in its context.
And so is this dialect (Caution: C# code inside!):
Person: "Person's details." [
Honourific: Honourific Global/Mesh/Honourifics
Forename: string
Surname: string
Nickname: string
Gender: Gender
Relations: many Relation
Birthday: DateTime
Residence: Residence Global/Mesh/Residences
Cellphone: Cellphone Global/Mesh/Cellphones
Address: Address Global/Mesh/Addresses
Email: many Email
this: {
public string Age {
get {
if (0 != birthday.Ticks) {
int Days, Months, Years;
DateTime Now = DateTime.Now;
DateTime Birth = Birthday;
Days = Now.Day - Birth.Day;
if (Days < 0) {
Months = Birth.Month + 1;
Years = Birth.Year;
if (12 < Months) {
Months = 1;
Years++;
}
DateTime n = new DateTime (Years, Months, 1);
Days = (n - Birth).Days + Now.Day - 1;
Birth = n;
}
Months = Now.Month - Birth.Month;
Years = Now.Year - Birth.Year;
if (Months < 0) {
Months = Months + 12;
Years = Years - 1;
}
return Years + " years, " + Months + " months, " + Days
+ " days.";
}
return "";
}
}
public override string ToString () {
return Forename + " " + Surname;
}
}
]
:)
Andrew J Martin
Speaking in tongues and performing miracles.
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://Valley.150m.com/