A While loop (created with the While and End While actions) repeats a series of actions as long as a particular condition (specified in the While action) is satisfied.
En While-slinga (som skapas med åtgärderna While och End While) upprepar en rad åtgärder så länge ett visst förhållande föreligger (som anges i åtgärden While).
Step 5 We are going to use a simple While loop that stops when the brightness value is less than 1.
Vi ska nu använda en enkel While-loop som stoppar när ljusintensitetsvärdet är mindre än 1.
Step 5 We then initialize another variable, D, to get the While loop started.
Steg 5 Vi initierar sedan en annan variabel, färg, för att få igång While-loopen.
If desired, add an Output(statement to this While loop to display the current distance to make sure things are working properly.
Om så önskas, lägg till en DispAt-sats till denna While-loop för att visa aktuellt avstånd och se att allt fungerar som det är tänkt.
Step 4 We will use a While loop to look for a change in color but first we need to know what color the Rover currently 'sees'.
Steg 4 Vi ska senare använda en While-loop för att titta efter färg- ändringar men först måste vi veta vilken färg som Rover "ser" för tillfället.
When the While loop ends, this indicates that the Rover is too close to an obstacle.
När While-loopen slutar indikerar detta att Rover är för nära ett hinder.
Inside the While loop, we monitor the color sensor as long as the Rover is moving.
Inom While-loopen, övervakar vi färgsensorn så länge som Rover rör sig.
Conținut posibil inadecvat
Exemplele au rolul de a te ajuta să traduci cuvinte sau expresii corect si adaptat la context. Nu sunt selectate sau validate manual, așadar pot conține termeni inadecvați. Te rugăm să raportezi exemplele pe care le consideri inadecvate. Traducerile vulgare sau colocviale sunt în general marcate cu roșu sau cu portocaliu.
Înregistrează-te pentru a accesa mai multe exemple