View Full Version : While Wend
DJEE
- 6th July 2007, 22:10
can a While statement only have one condition or can it have more than one condition?
example
While A = 1 AND B < 10
B = B + 1
Wend
ALFRED
- 6th July 2007, 23:35
I am not sure if you can have more than one condition in a WHILE WEND (although it would be easy enough to find out with a test program). If you can't have more than one condition then you could try to nest more than one WHILE WEND.
Ex:
WHILE A = 1
WHILE B < 10
LET B = B + 1
WEND
WEND
Just an idea
skimask
- 7th July 2007, 00:25
can a While statement only have one condition or can it have more than one condition?
example
While A = 1 AND B < 10
B = B + 1
Wend
The manual says 'Condition may be any comparison expression.'. So, while it doesn't specifically say that you can, it doesn't specifically say that you can't...use multiple expression's....or even nested While/Wend statements.
I think I'd still put the comparison inside parenthesis to avoid confusing the compiler.
paul borgmeier
- 7th July 2007, 06:01
Here is how I would do it (which wasn't your question). The nested WHILE WEND loops to simulate the AND condition can be tricky and are not as straight forward as they appear.
Loop:
If A=1 THEN
IF B < 10 THEN
B=B+1
GOTO Loop
ENDIF
ENDIF
GrandPa
- 7th July 2007, 07:07
while (selected = tag) and (tmr < duration)
...
wend
ALFRED
- 7th July 2007, 07:12
Here is how I would do it (which wasn't your question). The nested WHILE WEND loops to simulate the AND condition can be tricky and are not as straight forward as they appear.
Loop:
If A=1 THEN
IF B < 10 THEN
B=B+1
GOTO Loop
ENDIF
ENDIF
Or just
Loop:
IF A = 1 AND B < 10 THEN
B = B + 1
GOTO Loop
ENDIF
Melanie
- 7th July 2007, 07:50
Hey, a question from Melanie at last!!! Aimed at Paul though, being an avid sci-fi fan, I feel I should recognise your Avatar as Klingon or Cylon or something?
paul borgmeier
- 7th July 2007, 14:12
nice eye - my name tells all
paul borgmeier
- 8th July 2007, 06:01
another hint for Melanie (attached)
(you are now 8 of 9)
Or just
Loop:
IF A = 1 AND B < 10 THEN
B = B + 1
GOTO Loop
ENDIF
certainly more readable but
1) takes longer to evaluate in PIC time
2) takes more code space
{!r]
Melanie
- 8th July 2007, 08:34
*laughs* I didn't need the hint...
But I did think the Borg having a Logo is kinda illogical. Logo's are really a projection of power or identity... so, Klingon's yes, Romulans yes, even Starfleet, but for a bunch of bio-mechanical automatons that assimillated everything they came across, I didn't think they would need (or even collectively recognise the need for) a logo for 'brand awareness'. Next they'll be having a "mission statement"...
Hmmm... interesting accessory for the cat-suit... female Borg in tight leather... oh, they've already done that...
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.