Summary | Heaton Research

Summary

    Loops and control statements allow you to control the execution flow of the script. The if statements allow the script to make decisions and conditionally execute blocks of code. The switch and case statements work similarly to if statements except that they allow conditional execution based on a series of numeric values.

    When a block of code should be executed repeatedly, a loop should be considered. The Linden Scripting Language supports three loop types. The while loop will only execute if the initial condition is true. A do/while loop will execute at least once. A for loop executes over a defined set of numbers.

    All Second Life scripts are state machines. State machines are a common programming technique for organizing the execution of the program. The next chapter will explore state machines.

Copyright 2005-2008 by Heaton Research, Inc.