Randomizing image position in a slide object

David McFarlane mcfarla9 at msu.edu
Mon Feb 22 18:29:46 UTC 2010


> > Well, have an inline like this before the display appears:
> >
> > dim x as integer
> > x = random(1,3)
> > if x = 1 then c.setattrib "posX", 200
> > if x = 2 then c.setattrib "posX", 400
> > if x = 3 then c.setattrib "posX", 600

Just can't let this sit (even though Mich & I disagree on this point 
of programming style :) ), so here is the same code in two more 
different styles:

dim x as integer
x = random(1,3)
if x = 1 then
     c.setattrib "posX", 200
elseif x = 2 then
     c.setattrib "posX", 400
elseif x = 3 then
     c.setattrib "posX", 600
end if

or

dim x as integer
select case random(1,3)
   case 1
     c.setattrib "posX", 200
   case 2
     c.setattrib "posX", 400
   case 3
     c.setattrib "posX", 600
end select

-- David McFarlane, Professional Faultfinder

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list