WHILE-WEND/de

(Difference between revisions)
Jump to: navigation, search
((**COPIED FROM ENGLISH PAGE**) =)
(Remarks)
Line 19: Line 19:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Remarks</span> =
+
= <span class="f_Header">Anmerkungen</span> =
  
If the condition is true then any intervening statements are executed until the WEND statement is encountered.
+
Wenn die Bedingung wahr ist dann werden alle nachfolgenden Befehle ausgeführt bis das WEND erreicht wird.
  
BASCOM then returns to the WHILE statement and checks the condition.
+
BASCOM kehrt dann zum WHILE Befehl zurück und prüft die Bedingung.
  
If it is still true, the process is repeated.
+
Wenn die Bedingung immer noch wahr ist dann wiederholt sich dieser Ablauf.
  
If it is not true, execution resumes with the statement following the WEND statement.
+
Wenn die Bedingung nicht wahr ist dann wird der Programmablauf nach dem WEND fortgesetzt.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
So in contrast with the DO-LOOP structure, a WHILE-WEND condition is tested first so that if the condition fails, the statements in the WHILE-WEND structure are never executed.
+
Im Gegensatz zum DO-LOOP Befehl wird bei WHILE-WEND also die Bedingung am Anfang geprüft so dass die Befehle in der WHILE-WEND Schleife nie ausgeführt werden wenn die Bedingung nicht erfüllt ist.
 
+
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  

Revision as of 01:52, 17 February 2013

Funktion =

Führt eine Folge von Anweisungen in einer Schleife aus solange eine Bedingung wahr ist.

 

 

Contents

Syntax

WHILE condition

 statements

WEND

 

 

Anmerkungen

Wenn die Bedingung wahr ist dann werden alle nachfolgenden Befehle ausgeführt bis das WEND erreicht wird.

BASCOM kehrt dann zum WHILE Befehl zurück und prüft die Bedingung.

Wenn die Bedingung immer noch wahr ist dann wiederholt sich dieser Ablauf.

Wenn die Bedingung nicht wahr ist dann wird der Programmablauf nach dem WEND fortgesetzt.

 

Im Gegensatz zum DO-LOOP Befehl wird bei WHILE-WEND also die Bedingung am Anfang geprüft so dass die Befehle in der WHILE-WEND Schleife nie ausgeführt werden wenn die Bedingung nicht erfüllt ist.  

 

See also

DO-LOOP

 

 

Example


'-----------------------------------------------------------------------------------------
'name : while_w.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : demo: WHILE, WEND
'micro : Mega48
'suited for demo : yes
'commercial addon needed : no
'-----------------------------------------------------------------------------------------
 
$regfile = "m48def.dat" ' specify the used micro
$crystal = 4000000 ' used crystal frequency
$baud = 19200 ' use baud rate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
 
Dim A As Byte
 
A = 1 'assign var
While A < 10 'test expression
Print A 'print var
Incr A 'increase by one
Wend 'continue loop
End

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language