[Tutor] Values being skipped-Iteration

Remco Gerlich scarblac@pino.selwerd.nl
Mon, 14 May 2001 13:35:16 +0200


On  0, Sharriff Aina <NHYTRO@compuserve.com> wrote:
> Message text written by Remco Gerlich
> >In all of those if: clauses, all you do is: 1) increase counter, 2) print
> some html, 3) print x, 4) print some more html, right? Wouldn't it be
> easier
> to put all of that in a dictionary and print the appropriate string,
> instead
> of using a lot of ifs?<
> 
> It would have been easier, the problem is  that  I´m dynamically adding
> value "x" to the HTML, that means I would stll have to use ifs sinc
> Dictionaries have only one value per label :-(

But 
1) The x you add in the HTML is also the x you test for in the if. So it's
   always the same, in that if block.

2) You can put '%s' in the html template, and do something like 
   template_dict[x] % x
   later on to have it filled in.

The problem with skipping options is still strange though. Probably
something missing in 'links', or you made a mistake somewhere.

-- 
Remco Gerlich