Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hak5
GitHub Repository: hak5/usbrubberducky-payloads
Path: blob/master/payloads/examples/Loops/Loops-example2.txt
2971 views
1
REM Example while loop - press the button 5 times
2
3
VAR $FOO = 5
4
5
WHILE ( $FOO > 0 )
6
STRINGLN Press the button...
7
WAIT_FOR_BUTTON_PRESS
8
$FOO = ( $FOO - 1 )
9
END_WHILE
10
11
STRINGLN You pressed the button 5 times!
12
13
14
REM The variable $FOO is set to 5.
15
REM The code block within the WHILE loop will be repeated until the expression evaluates to FALSE.
16
REM For each run of the code block, the message "Press the button..." is typed. The payload then waits until it detects the button is pressed, at which point the variable $FOO is decremented.
17