Show/Hide Toolbars

XSharp

The NOP keyword allows you to define a line of code that does nothing but satisfies the compiler, so it will not complain about missing code.

 

// The NOP keyword is an empty statement.
// This tells the compiler that there is no code missing !
FUNCTION Start() AS VOID
LOCAL i as LONG
FOR i := 1 to 10
  IF I % 2 == 0
     Console.WriteLine(i)
  ELSE
     NOP     // Nothing happens here. This tells the compiler that there is no code missing !
  ENDIF
NEXT
RETURN