2023-01-19 21:27:15 +00:00
|
|
|
# filename: ch7-05-if-else-vars2.rsc
|
|
|
|
|
|
|
|
# Get the current time
|
|
|
|
:local CurrentTime [:system clock get time];
|
|
|
|
:put "The current time is : $CurrentTime";
|
|
|
|
|
|
|
|
# declare the time of day variable
|
2023-01-24 20:28:40 +00:00
|
|
|
:local TimeOfDay;
|
2023-01-19 21:27:15 +00:00
|
|
|
|
|
|
|
# Check if it's after noon
|
|
|
|
:if ($CurrentTime > 12:00) do={
|
2023-01-24 20:28:40 +00:00
|
|
|
:set TimeOfDay "Afternoon/Evening";
|
2023-01-19 21:27:15 +00:00
|
|
|
} else={
|
|
|
|
# otherwise, it must be morning (00:00 to 11:59)
|
2023-01-24 20:28:40 +00:00
|
|
|
:set TimeOfDay "Morning";
|
2023-01-19 21:27:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Print out the time of day
|
2023-01-24 20:28:40 +00:00
|
|
|
:put "At the moment, it's : $TimeOfDay";
|