|Home | Tutorial | Classes | Functions | QSA Workbench | Language | Qt API | QSA Articles | Qt Script for Applications |

[Prev: while] [Home]

### with

    with ( QualifyingName ) {
        Statements;
    }

This keyword is used to indicate that any unqualified names in the Statements should be qualified by QualifyingName.

Example:

    // Without with
        System.print "one ";
        System.print "two ";
        System.println "three";
    // With with
        with ( System ) {
            print "one ";
            print "two ";
            println "three";
        }

If multiple qualifying names are required, with statements can be nested, e.g.

        with ( System ) {
            with ( Math ) {
                print abs( -4 );
                print pow( 2, 3 );
                print random();
            }
        }

Forcing the interpreter to do the lookup may be slower than using the fully qualified names.

[Prev: while] [Home]