2007-09-28から1日間の記事一覧
ループの中で暗黙的に定義される、最初の一回はtrueとなりそれ以降はfalseとなる変数「first_step」を実装しました。 3.times{ first_step.p; } //=> true //=> false //=> false for(i: 0; i<3; ++i){ if(first_step){ "a".p; }else{ "b".p; } "!".p; } //=…
ループの中で暗黙的に定義される、最初の一回はtrueとなりそれ以降はfalseとなる変数「first_step」を実装しました。 3.times{ first_step.p; } //=> true //=> false //=> false for(i: 0; i<3; ++i){ if(first_step){ "a".p; }else{ "b".p; } "!".p; } //=…