Question about If and else

Discussion, questions and support.
Post Reply
User avatar
george_lobo
Posts: 14
Joined: Apr 10th, ’21, 05:18
Location: Ciudad de México

Post by george_lobo » Apr 13th, ’23, 21:45

Hello, following the example of the last video on Youtube, I would like to use the IF ELSE depending on the time, but with 3 options,

For good morning, good afternoon and good night

How can I do it?

I have tried writing 3 IF but it has not worked.

Code: Select all

%DATETIME_hora%
%IF_manana%
Gracias, buenos días.
%IF_tarde%
Gracias, buenas tardes.
 %IF_noche%
Gracias, buenas noches.
%END%
Image
crear wikipedia gratis

Image
crear wikipedia gratis

Image
crear wikipedia gratis

Image
crear wikipedia gratis

Image
crear wikipedia gratis

What am I doing wrong? I hope you can help me, thanks in advance
Jorge Aguero Lobo
perfectrecall
Posts: 18
Joined: Mar 20th, ’23, 08:48

Post by perfectrecall » Apr 14th, ’23, 06:46

Every "If" condition must be finished with its "End". So, it looks like:

Code: Select all

%DATETIME_hora%
%IF_manana%Gracias, buenos días.%END%
%IF_tarde%Gracias, buenas tardes.%END%
%IF_noche%Gracias, buenas noches.%END%
For simplicity and if you will not use for another purpose, you do not need to create a DATETIME variable. You can use "A_Hour" in the condition menu. Also, time range needs limitations by using operators (less than "<" and less than or equal to "<="). So, it looks like:
A_Hour<12
12<=A_Hour<=18
18<A_Hour<=20

Code: Select all

%IF_manana%Gracias, buenos días.%END%
%IF_tarde%Gracias, buenas tardes.%END%
%IF_noche%Gracias, buenas noches.%END%
User avatar
george_lobo
Posts: 14
Joined: Apr 10th, ’21, 05:18
Location: Ciudad de México

Post by george_lobo » Apr 16th, ’23, 01:52

Ohhh, thanks perfectrecall, works great::

Code: Select all

%IF_manana%Gracias, buenos días.%END%%IF_tarde%Gracias, buenas tardes.%END%%IF_noche%Gracias, buenas noches.%END%
Jorge Aguero Lobo
Post Reply