2023-01-19 21:27:15 +00:00
|
|
|
# filename: ch7-04-if-else-vars.rsc
|
|
|
|
|
|
|
|
# Get the current time
|
2023-05-29 07:47:33 +01:00
|
|
|
:local CurrentTime [/system clock get time];
|
2023-01-19 21:27:15 +00:00
|
|
|
:put "The current time is : $CurrentTime";
|
|
|
|
|
|
|
|
# Check if it's after noon
|
|
|
|
:if ($CurrentTime > 12:00) do={
|
2023-01-24 20:28:40 +00:00
|
|
|
:local 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
|
|
|
:local 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";
|