Skip to content

Instantly share code, notes, and snippets.

View vihar's full-sized avatar
🚀

Vihar Kurama vihar

🚀
View GitHub Profile
name = "Agent 47"
code_number = 1011010
message = "Hey {}, your code number is {}.".format(name, code_number)
print(message)
try:
print(1 / 0)
except ZeroDivisionError:
print("You can't divide by zero.")
try:
a = int(input("Enter a negative integer: "))
if a >= 0:
raise ValueError("That is not a negative number!")
except ValueError as ve:
print(ve)
try:
f = open("test.txt", encoding='utf-8')
# perform file operations
finally:
f.close()
fn main(){
println!("Hello World!");
}
//Line comment which go to the end of the line.
fn main(){
println!("Hello World, I am not given a comment.");
//println("I am ignored by the compiler");
/*
Large chunck of code can be commented this way !
So it takes only a few symbols to comment out all these lines.
*/
}
fn main(){
let x = 5;
x = 10;
}
fn main(){
let mut x = 5; // mut x: i32
x = 10;
}
fn main(){
let t = true;
let f = false;
}
fn main(){
let a = ‘a’;
let b = ‘b’;
let love = ‘❤’;
}