H.O.O.P. (Hope) - Homey Object Oriented Programming

Hey Peter,

I see you use two cards for If Then:
IF (all cards until THEN are true); Operator = AndAlso &&
and then this card:
THEN

But this card does the same and has the THEN operator included:
IF the next X cards are true THEN execute the X cards after that; Operator = AndAlso &&

To me the first way is somewhat clearer to read, because there is a THEN operator card visible, which isn’t the case with the 2nd case. I think in hindsight it’s a bit more difficult to ‘read’ the flow steps.
Is it matter of ‘taste’, what you like? Or an other idea behind it?

Well, it indeed is kind off a taste thing yeah.
For complex statements, i would advise to use the “normal” IF, THEN, ELSE and END IF cards.

The thought after IF-THEN and IF-ELSE-THEN (and i am creating a ELSE-THEN) cards, is “single line” statements.

IF-THEN statements | Homey

When you fill a string/text with a lott of possible values, it usually means a lott of single-line-statements, like this:
IF vaccuumbin is Full THEN str = str + “Bin is full!”

If you program block-statements, you need 5 cards for this.

  • IF
  • condition
  • THEN
  • execution
  • END IF

This just felt wrong to me, because i would be using this a lott (programming single-line IF-THEN statements.

With the IF-THEN, you just need 3 cards:

  • IF the next 1 card is true, execute the next 1 card
  • condition
  • execution
    image

And when i made it, i thought: why would i fix it to The next card and the Card after that?
So i bould it so you can set the the amount If/Then cards yourself :slight_smile: Its just more flexable that way.

In big string-collection flows, these IF-THEN and IF-ELSE-THEN cards are a real space-saver and therefor performance-saver (on the Homey mobile App anyway).

But for any other use then simple IF-THEN (string) collection flows, i would advise to use the IF and THEN cards, as, indeed, this is more clearly readable and less error prone.

1 Like