Re: [Tutor] constants, flags or whatever

2007-12-19 Thread Steve Willoughby
Dave Kuhlman wrote: > On Wed, Dec 19, 2007 at 09:41:13PM -0500, bob gailer wrote: > >> 1 - I see no value in introducing variables. I'd just use string constants: >> >> action = "moving" >> . >> . >> if action == "jumping": >> >> etc. > > I agree. But, some people do prefer something that looks

Re: [Tutor] constants, flags or whatever

2007-12-19 Thread Dave Kuhlman
On Wed, Dec 19, 2007 at 09:41:13PM -0500, bob gailer wrote: > 1 - I see no value in introducing variables. I'd just use string constants: > > action = "moving" > . > . > if action == "jumping": > > etc. I agree. But, some people do prefer something that looks a bit like an enum. If so, here i

Re: [Tutor] constants, flags or whatever

2007-12-19 Thread bob gailer
Jim Morcombe wrote: > In a program, I want to set some kind of variable or object to > indicate what "mode" the program is currently in. > What is the most elegant way of doing this? > > Jim > --- > constant: moving = "m" >

Re: [Tutor] constants, flags or whatever

2007-12-19 Thread bhaaluu
This isn't elegant, but it is a start. My method is: get SOMETHING working, then work from there. 8^D """ constant: moving = "m" constant: inserting = "i" constant: jumping = "j" . . action = moving . . . if action == jumping: jumpSomewhere() elseif action == moving: moveSomewhere() elseif

[Tutor] constants, flags or whatever

2007-12-19 Thread Jim Morcombe
In a program, I want to set some kind of variable or object to indicate what "mode" the program is currently in. What is the most elegant way of doing this? Jim --- constant: moving = "m" constant: inserting = "i" constant:ju