Today's Code

Singleton パターン

Singleton.as package { public class Singleton { // インスタンスを保持。 private static var _instance:Singleton=null; // コンストラクタ。 public function Singleton(enforcer:SingletonEnforcer) { } // 静的プロパティからインスタンスを取得しま…

Flex アプリケーションを ActionScript から開始する

ActionScriptedApplication.as package { import spark.components.Application; /** * spark.components.Application を継承するクラス。 */ public class ActionScriptedApplication extends spark.components.Application { /** * コンストラクタ。 */ pu…

ブロックとイテレータ

a = [3, 2, 1] a[3] = a[2] - 1 a.each do |elt| print elt + 1 endh = { :one => 1, :two => 2 } h[:one] h[:three] = 3 h.each do |key, value| print "#{value}:#{key}; " endまつもと, ゆきひろ = Flanagan, David 「1.1.2 ブロックとイテレータ」『プロ…

ブロックとイテレータ

ruby -e "1.upto(9){ |x| print x }"まつもと, ゆきひろ = Flanagan, David 「1.1.2 ブロックとイテレータ」『プログラミング言語 Ruby 』 2009年1月 オライリー・ジャパン isbn:9784873113944 p3 広告 Ruby

ブロックとイテレータ

ruby -e '3.times { print "Ruby ! "}'まつもと, ゆきひろ = Flanagan, David 「1.1.2 ブロックとイテレータ」『プログラミング言語 Ruby 』 2009年1月 オライリー・ジャパン isbn:9784873113944 p3 広告 Ruby

イテレータと yield

using System; using System.Collections; using System.Collections.Generic; public class Program { /// <summary> /// このプログラムのメイン・エントリポイントです。 /// </summary> public static void Main() { // 列挙可能な文字列を生成します EnumarableStrings str…

イベント、デリゲート、ラムダ式

using System; public class Program { /// <summary> /// このアプリケーションのメイン・エントリポイントです。 /// </summary> public static void Main() { // イベントハンドラを宣言 EventHandler handler; // イベントハンドラをラムダ式で生成 handler = (sender, e) =…