Skip to content

Instantly share code, notes, and snippets.

@samnang
Created December 26, 2010 12:30
Show Gist options
  • Save samnang/755398 to your computer and use it in GitHub Desktop.
Save samnang/755398 to your computer and use it in GitHub Desktop.
//Swap value between two variables
int a = 5, b = 10;
int temp = a;
a = b;
b = temp;
//Output message 3 times
for(int i = 0; i <= 3; i++)
Console.WriteLine("Hello");
//Output message if condition is true string
str = string.Empty;
if(str == string.Empty)
Console.WriteLine("str is empty");
#Swap value between two variables
a, b = 5, 10
a, b = b, a
#Output message 3 times
3.times { puts "Hello" }
#Output message if condition is true
str = ''
puts "str is empty" if str.empty?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment