C
C#17mo ago
Nonethousand

✅ use one string if a condition is true, else use another string

Sorry if the title is unclear but is there something like python's
foo = "hello" if condition else "world"
foo = "hello" if condition else "world"
(This is not how I'm actually going to use it, it's just an example) But for c#? Or will I just have to do something like set a variable beforehand?
3 Replies
SpicyCatGames
SpicyCatGames17mo ago
foo = (condition) ? "hello" : "world"; It's called ternary operator
Nonethousand
Nonethousand17mo ago
Alright thanks
Accord
Accord17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.