XLOGO has several primitives for date, time or generating countdown.
Halts the program, and therefore the turtle, for seconds.
Starts a countdown of n seconds. We know if this countdown has finished with the primitive endcountdown?
Returns "true if there’s no active countdown. Returns "false if the countdown is active.
Returns a list wich contains three integers representing the date. The first integer indicates the day, the second the
month and the last the year. —> [day month year]
Returns a list of three integers representing the time. The first integer indicates the hour, the second the minutes
and the last the seconds. —> [hour minute seconde]
Returns the past time in seconds since XLOGOhas started.
Difference between wait and countdown is that countdown doesn’t halt the program.
Here is an example:
to clock
# shows time in numerical format
# we refresh the time each five seconds
if endcountdown? [
cs
sfont 75 ht
make "heu time
make "h first :heu
make "m item 2 :heu
# We shows two number for seconds and minutes. (we must add a 0)
if :m-10<0 [make "m word 0 :m]
make "s last :heu
# We shows two number for seconds and minutes. (we must add a 0)
if :s-10<0 [make "s word 0 :s]
label word word word word :h ": :m ": :s
countdown 5
]
clock
end