...
Code Block | ||
---|---|---|
| ||
int $PJ = 5; while ($PJ > 0) { print ("There are " + string($PJ) + " P.J. sandwiches left."); $PJ = $PJ - 1; } print ("Houston, we have a problem!"); |
...
Code Block | ||
---|---|---|
| ||
//Define the statement you are going to print each iteration string $statement; //Define variables to use as counters int $i, $ j; //Start the $i loop and specify start, end, and amount to increment for( $i = 1; $i < 6; $i += 1 ) { //Start the $ j loop and specify start, end, and amount to increment for( $j = 1; $j < 15; $j += 2 ) { //Tell Shogun Post to print something if $i < $J if( $i < $j ) $statement = string( $i ) + " is less than " + string( $j ); //Tell Shogun Post to print something else if $i > $j else if( $i > $j ) $statement = string( $i ) + " is greater than " + string( $j ); //Tell Shogun Post what to print if the two counters are equal else $statement = "This is what happens when things coincide"; //Tell Shogun Post to actually print the statement you've assembled print( $statement ); //Close the second loop } //Close the first loop } |
...
Code Block | ||
---|---|---|
| ||
// Courtesy of Jake Wilson of SCEA // Initialize Variables print " "; // Create array of children under 'Actor' Mary's character node string $childarray[] = `getChildren Mary`; // Determine # of children int $childcount = `getCount $childarray`; // Create a $childarrayloop to hold a number int $childarrayloop = 0; // Print an empty string string $ proptest; // Start a loop which run once for each of Mary's children for ( $childarrayloop=0 ; $childarrayloop < $childcount ; $childarrayloop +=1 ){ // print name of current child marker in array print ( string ($ childarray[$childarrayloop] ) ); // return the name of the marker and compare the name // of the marker to the name"LFWT" $ proptest = ` getStringProperty $ childarray[$childarrayloop] Name`; if ($ proptest==LKNE){ // if that LFWT marker is found, this tells the loop to quit $ childarrayloop=$childcount; print ( "EXITING LOOP" ); } } |
Scroll pagebreak |
---|
Use interruption statements (break)
...