インクリメント 前置演算と後置演算

by tepe
♥0 | Line 19 | Modified 2014-05-20 08:40:58 | MIT License
play

ActionScript3 source code

/**
 * Copyright tepe ( http://wonderfl.net/user/tepe )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ydZc
 */

package {
    import flash.display.*;
    import flash.text.*;
    
    public class FlashTest extends Sprite {
        
        public function FlashTest() {
            
            var t:TextField = new TextField();
            t.height=400;
            t.width=400;
            addChild(t);
            
            var i:int;
            t.text="i++ : インクリメントする前に値を参照する\n";
            i=0;
            t.appendText((i++).toString()+"\n");
            
            t.appendText("++i : 先にインクリメントしてから値を参照する\n");
            i=0;
            t.appendText((++i).toString()+"\n");

            


        }
    }
}