Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. using System;
  2.  
  3. namespace constants
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int a = 10;
  10. //The variable b is a constant and can't be changed after being assigned.
  11. const int b = 15;
  12.  
  13. a = 5;
  14. //If we try this we will get an exception.
  15. //b = 10;
  16.  
  17. Console.WriteLine("a: " + a + " b:" + b);
  18. Console.ReadLine();
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement