Guest User

Untitled

a guest
Dec 14th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. using mold.lang
  2. using mold.collections
  3.  
  4.  
  5. def doors = List() // mold.collections.List[?]
  6.  
  7. def rand = Random() // mold.lang.Random
  8. foreach n in 1..100 {
  9. def door_state = rand.next( 1, n + 1 ) % 2 == 0
  10.  
  11. doors.add( door_state )
  12. }
  13.  
  14. foreach n in 1..100 {
  15. println( 'Door #{0} is {1}', n, if doors[n] then 'Open' else 'Closed' )
  16. }
Add Comment
Please, Sign In to add comment