Fix endwhile bug and add more examples.