procedure first(i) count := 0 while line := read() do { count := count + 1 if count > i then break write(line) } if i > count then fail else return end