Using while and end while keywords we can define a loop.
whileLoop.txt
@startuml title "Print the file data to console" !pragma useVerticalIf on start while (have more data?) :read next 1024 bytes from file to a buffer; :print buffer data to console; endwhile :Print 'finished reading the file'; stop @enduml
Above snippet generate below diagram.
You can even provide labels for while, endwhile keywords.
whileLabel.txt
@startuml title "Print the file data to console" !pragma useVerticalIf on start while (have more data?) (yes) :read next 1024 bytes from file to a buffer; :print buffer data to console; endwhile (no) :Print 'finished reading the file'; stop @enduml
Above snippet generate below diagram.
No comments:
Post a Comment