C
C#2y ago
Ewan

✅ Why arent these variables being printed outside the loop?

No description
15 Replies
Ewan
EwanOP2y ago
the variables on the last line arent being printed out, its just blank, why?
Pobiega
Pobiega2y ago
because this isnt javascript thats not how Console.WriteLine works
Ewan
EwanOP2y ago
how would i output these variables?
Pobiega
Pobiega2y ago
use string interpolation
Ewan
EwanOP2y ago
with the $ sign? and the {} ?
Pobiega
Pobiega2y ago
$"> {fizz} {buzz}..." yea
Ewan
EwanOP2y ago
ohhhh i see ok thanks again!! yay
Pobiega
Pobiega2y 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
EwanOP2y ago
i see
Pobiega
Pobiega2y ago
generally its preferred to just use string interpolation, and let the compiler decide what to do instead
daniel2
daniel22y ago
Can I ask a question here?
Ewan
EwanOP2y ago
i knew it wanted string as the first one hence the ">" first. i swear its worked before but ok thank you again!
Pobiega
Pobiega2y ago
make your own thread, or ask in #help-0
Ewan
EwanOP2y ago
!close
Accord
Accord2y ago
Closed!

Did you find this page helpful?