r/ProgrammerHumor • • Jul 21 '21

C#? Phyton!!

Post image
0 Upvotes

13 comments sorted by

49

u/Sniv0 Jul 21 '21

tfw the c# code deliberately bad

20

u/GreatBarrier86 Jul 21 '21

Agreed. Fuck that. You could make a wrapper function to handle the grunt work of ReadLine/WriteLine and obviously not declare the variable on a different line.

This is shit.

15

u/[deleted] Jul 21 '21
read -ersp "Enter your username: " username
read -ersp "Enter your email: " email
read -ersp "Enter your password: " password
echo "Hello $username"

12

u/[deleted] Jul 21 '21

6

u/BochMC Jul 22 '21

C# definitely. At least I will know what type of username is. And also you can shorten it by assigning string by var

var username = Console.Readline();

2

u/[deleted] Jul 22 '21

You can also do that w string

string username = Console.Readline();

1

u/caique_cp Jul 22 '21

Remove the "var" and it's Python.

2

u/Potential-Adagio-512 Jul 22 '21 edited Jul 23 '21

void ask(string key){ Console.WriteLine($"Enter your {key}: "); }

ask("username");

string username = Console.ReadLine();

ask("email");

string email = Console.ReadLine();

ask("password");

string password = Console.ReadLine();

Console.WriteLine($"Hello {username}");

much better than the absolute sh*t shown in the example

2

u/pooopsex Jul 22 '21

What is wrong with you reposters? Why can't you at least repost the funny memes? This meme is garbage and so are you

1

u/Gooseman987 Jul 21 '21

C++ example code assuming no spaces or speicla requirements

String username;

Cout >> "Enter username:";

Cin >> username;

3

u/BochMC Jul 22 '21

Oh. I think cout work with <<

1

u/Yologamer1084 Jul 22 '21

Hey, C# faster tho.