© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
✅ use one string if a condition is true, else use another string - C#
C
C#
•
4y ago
•
4 replies
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
?
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
62,470
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
How do I use a string from one class to another?
C
C# / help
3y ago
✅ just a quick question about if, else, else if
C
C# / help
2y ago
Refactoring if else
C
C# / help
4y ago