Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. package metaobjectTest
  2.  
  3.  
  4. @doc{*
  5. Annotation 'letter' should be attached to a Char in a variable
  6. declaration. It checks whether a value assigned to the
  7. variable is a letter.
  8. *}
  9. object Letter
  10.  
  11. func run {
  12. var Char@letter ch;
  13. ch = 'a'; // ok
  14. var Char other = '#';
  15. var ok = false;
  16. {
  17. ch = other; // runtime error
  18. } catch: { (: CyException e :)
  19. ok = true
  20. };
  21. assert ok;
  22.  
  23. }
  24.  
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement