0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Perl 6Advent Calendar 2017

Day 8

Advent of Code day5をPerl 6で

Last updated at Posted at 2017-12-08

こんにちは、8日目の投稿になります。
今日は投稿がなかったようなので、私のAdvent of Code day5の回答を貼っておきます。

use v6;                                                                                                                                                
my Int @maze = $*IN.lines>>.Int;                                                                                                                       
my Int $pos = 0;                                                                                                                                       
do while $pos != +@maze {                                                                                                                              
    $pos += @maze[$pos]++;                                                                                                                             
    1                                                                                                                                                  
}.sum.say;                                                                                                                                             
  • ポイント
    • do-whileを使うとブロックの最後の値が評価されたもののリストを作ることができます

以上、8日目の投稿でした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?