Advertisement
nahidjamalli

Lesson #2

Feb 16th, 2020
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. namespace MyNamespace
  2. {
  3.     class Program
  4.     {
  5.         // Function has 3 parts.
  6.         // 1. Type
  7.         // 2. Name
  8.         // 3. Parameter List
  9.         // Functions must be declared only in class or struct.
  10.  
  11.         //     [type]  [name]         [parameter list]
  12.         string sayHello(string name, string surname)
  13.         {
  14.             string text = "Hello, " + name;
  15.             return text;
  16.         }
  17.  
  18.         static void Main()
  19.         {
  20.             Program p = new Program();
  21.  
  22.             string result = p.sayHello(surname: "Alizada", name: "Vagif");
  23.  
  24.             System.Console.WriteLine(result);
  25.             // System.Console.WriteLine("Hello, Vagif");
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement