samedi 20 août 2016

Toggle switch / T-Flip Flip

I am having trouble trying to apply a flip-flop to the following scenario. Say I have the following array:

[ 'on',
  'random text',
  'random text',
  'random text',
  'random text',
  'off'
  'random text',
  'random text',
  'on'
  'random text',
  'off'
  'random text',
  'random text',
   etc...

I want a switch to flip according to one of two values (as represented by 'on' and 'off' in the array)

How would I go about this in Ruby? I can see the flip-flop functionality, but unfortunately I have no way of determining a value to trigger true/true as the text will always be random.

Any help is appreciated

Aucun commentaire:

Enregistrer un commentaire