Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 917 Bytes

File metadata and controls

26 lines (17 loc) · 917 Bytes

While-loop

  • The while statement creates a loop that executes a specified statement as long as the test condition evaluates to true. The condition is evaluated before executing the statement.

  • While loops are also possible in PawnScript:

new[int]testvar=0
while.notequ,testvar,10->testvar=testvar+1&console.println("{testvar}")

Code above is going to count from 1 to 10.

You may also combine other statements; such as if-expressions; with while-loops.

if.equ,1,1->while.equ,testvar,11->testvar=testvar+1&console.println("This should be printed again!")

While-methods

While-method is a new term used to describe the way how are you comparing the 2 elements, there are few while-methods:

  • equ - check if 2 elements are equal.
  • notequ - check if 2 elements are not equal.