Last active
August 29, 2015 14:24
-
-
Save AFelipeTrujillo/534d7052d50b1a38a6d7 to your computer and use it in GitHub Desktop.
CSharp For Beginner - Assignment Variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace CSharpBeginner | |
{ | |
public class VariablesClass | |
{ | |
public VariablesClass () | |
{ | |
} | |
//this function recives two params, sum and return total | |
public float sum(float x, float y){ | |
return x + y; | |
} | |
public float subtraction( float x, float y){ | |
return x - y; | |
} | |
//this function return a string and concat the function param. | |
public string yourName(string name){ | |
return "Your name is:" + name; | |
} | |
//this function uses an implicit varible and return a String | |
public string implicitMethod (int x, string y){ | |
return x.ToString() + " - " + y; | |
} | |
//this function uses an explicit coversion | |
public int explicitSum(int x, string y){ | |
//Parse convert a String to Integer | |
return x + int.Parse(y); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment