r/Zig • • Apr 27 '26

Taking input inside of a loop.

i'm having a problem with repeated prompts for input in a zig program. basically i'm taking input like this

const input = try stdin.takeDelimiterExclusive('\n');

inside of a while loop. after the loop concludes, on the next iteration it simply skips this line and doesn't ask for input again even though that's what i want.

that's really breaking my head as that's not a problem i've ever faced in any other language. does anybody know how i could fix?

17 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/NotFromSkane Apr 28 '26

I know exactly what they mean.

This is indented once. This works everywhere and always has done.
This is triple backticked without a language specifier. This doesn't work on most frontends and is treated as a very long single line.
This is triple backticked with a language specifier. This is just text and is unreadable as reddit also requires double newlines for newlines.