C
C#15mo ago
Ewan

✅ Why arent these variables being printed outside the loop?

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

Did you find this page helpful?