December 2004
Beginner
600 pages
13h 42m
English
-- Program to give a greeting
set today to current date
set weekdayToday to the weekday of today
if weekdayToday = Monday then
set message to "Hope you had a great weekend!"
else if weekdayToday = Wednesday then
set message to "Happy Hump Day!"
else if weekdayToday = Friday then
set message to "TGIF!"
else if weekdayToday = Saturday or weekdayToday = Sunday then
set message to "What are you doing here on the weekend?"
else
set message to "Have a Great Day!"
end if
display dialog message with icon note buttons {"Thanks!"}
The steps to do this are outlined in the chapter.
true and true -- true true and false -- false true or false -- true false or false -- false not true and false -- false true and not false or true -- true true and not (false or true) -- false
1986 - yes , 1989 - no , 2000 -- yes, 2010 -- no, 2100 - no
The null string becomes 0 when coerced into a number.
-- Speak salutation based on the time
set secsSinceMidnight to time of (current date)
set sixPM to time of date "6 PM"
set noon to time of date "12 PM"
if secsSinceMidnight < noon then
say "Good morning!"
else if secsSinceMidnight noon and secsSinceMidnight < sixPM then
say "Good afternoon!"
else
say "Good evening!"
end if
-- Simple alarm clock program -- sets an alarm a specified number of seconds in the ...
Read now
Unlock full access