C
C#14mo ago
Ewan

✅ Why arent these variables being printed outside the loop?

No description
15 Replies
Ewan
EwanOP14mo ago
the variables on the last line arent being printed out, its just blank, why?
Pobiega
Pobiega14mo ago
because this isnt javascript thats not how Console.WriteLine works
Ewan
EwanOP14mo ago
how would i output these variables?
Pobiega
Pobiega14mo ago
use string interpolation
Ewan
EwanOP14mo ago
with the $ sign? and the {} ?
Pobiega
Pobiega14mo ago
$"> {fizz} {buzz}..." yea
Ewan
EwanOP14mo ago
ohhhh i see ok thanks again!! yay
Pobiega
Pobiega14mo ago
the overload you used is public static void WriteLine (string format, params object?[]? arg); it expects a format string as the first argument, with placeholders
Ewan
EwanOP14mo ago
i see
Pobiega
Pobiega14mo ago
generally its preferred to just use string interpolation, and let the compiler decide what to do instead
daniel2
daniel214mo ago
Can I ask a question here?
Ewan
EwanOP14mo ago
i knew it wanted string as the first one hence the ">" first. i swear its worked before but ok thank you again!
Pobiega
Pobiega14mo ago
make your own thread, or ask in #help-0
Ewan
EwanOP14mo ago
!close
Accord
Accord14mo ago
Closed!
Want results from more Discord servers?
Add your server