Using #define like in C++

I’ve tried using defines like I saw in other scripts on forums (they were C++) and they could redefine like everything like the definition of an int would be aiwufb

so you could type

aiwufb thisInt = 0;

or even change void to whatever

so

public whatever Main()
{

}

is this possible in C# too? I believe yes but Unity changes alot… tried it myself quickly but getting Single-Line comment or end-of-line expected.

No, it’s not possible in C#. The only thing you can do with #define statements in C# is use them to control #if blocks.

aww too bad I really wanted to mess with my colleages head with the weirdest code ever…

also why would u make such if statements and not use normal if statements?

Because #if statements are handled at compile time, which makes them useful for platform-specific code. For instance, some iOS code can’t be run on desktop machines, and some code you write for desktop machines you probably wouldn’t want to run on mobiles.

As for messing with colleagues… yes, the kind of usage you’re talking about does mess with people, and not just when it’s done in jest. The things could easily become major headaches, so C#'s designers decided to restrict them to only the highest value, least painful parts of what they’re used for.