Skip to content

Commit

Permalink
Model code for Collatz example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Bandur committed Nov 21, 2016
1 parent 7438438 commit 7ce98a9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/vdm2c/src/test/resources/vdmrt/classes/ClassScratchWork.vdmrt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ updateSeqInstanceVar () ==

end ClassCollectionUpdate


class Collatz
instance variables
val : int;

operations
public run : () ==> ()
run() ==
if val = 1 then
return
elseif val mod 2 = 0 then
val := val div 2
else
val := 3 * val + 1;
end Collatz

--class ScratchA
--end ScratchA
--
Expand Down

0 comments on commit 7ce98a9

Please sign in to comment.