"Sputnik" help  
Sputnik Help
While, Until, EndW, EndU

Description

The while directive facilitates the creation of loop constructs based on a specified condition. The condition can be either a value or a logical expression similar to the conditions used in #if directives.

The until loop provides a convenient way to repeatedly execute a block of code until a specified condition becomes true. The syntax is similar to the while loop, but the loop continues executing until the specified condition evaluates to true.

Varients

until: The until loop executes a block of code repeatedly until a specified condition becomes true.
while: The while loop executes a block of code repeatedly as long as a specified condition remains true.

Parameters

<condition>

The condition that determines whether to continue iterating. It can be either a value or a logical expression.

Remarks

To learn more go the main preprocessor macro section.

Related

Example (#)

Example of usage:

#eq PAX 10
#while PAX
    say PAX;
    #dec PAX
#endw

// PRINTS
// 10
// 9
// 8
// 7
// 6
// 5
// 4
// 3
// 2
// 1

Using a variable:

#define COUNTER 10

#while COUNTER
    say COUNTER;
    #dec COUNTER
#endw

// PRINTS
// 10
// 9
// 8
// 7
// 6
// 5
// 4
// 3
// 2
// 1

Until example:

#eq PAX 10
#until PAX == 0
    say PAX;
    #dec PAX
#endu

// PRINTS
// 10
// 9
// 8
// 7
// 6
// 5
// 4
// 3
// 2
// 1

 

Example (.)

Example of usage:

#macro foo()
    .eq PAX 10
    .while PAX
        say PAX;
        .dec PAX
    .endw
#endm

foo();

// PRINTS
// 10
// 9
// 8
// 7
// 6
// 5
// 4
// 3
// 2
// 1

Until example:

#macro foo()
    .eq PAX 10
    .until PAX == 0
        say PAX;
        .dec PAX
    .endu
#endm

foo();

// PRINTS
// 10
// 9
// 8
// 7
// 6
// 5
// 4
// 3
// 2
// 1

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org