PricingBlog

"Current cells index" logic.

  • slagarthecruel-1234578189435535411

    SlagarTheCruel

    1 year ago

    Hey guys,

    Trying to familizarize myself with Toddle via the "Toddle in 7 days" series.

    Am working on the Blackjack project - in the video we have both the dealers cards showing the backside of the card until it is the dealers turn. In reality, when a blackjack hand is dealt, we see one of the dealers cards primarily.

    So in the dealers hand, there is an array of 2 items (cards) and I want to set it so that "If index = 0 then img should be card-back, otherwise show face-card".

    Coming from Bubble, this would be a "If Current cells index = 1, then img = XYZ".

    Struggling to work out how to accomplish this in Toddle.

    This is what I have so far but no dice:


    TIA
    1234578189653901353-image.png
  • andreasmoller-1234583772125462579

    Andreas Møller

    1 year ago

    You are doing it right. The only problem is that you are comparing the number 0 to the string “0” which is two different values. You can use the Number formula to convert it to a number
  • Doh! I knew it'd be something obvious like that! Thanks.
  • andreasmoller-1234590148222521546

    Andreas Møller

    1 year ago

    No. Lots of people struggle with that. It is not very clear 🙂