I thought I was writing a Ruby program, so I made a note.
On POSIX, a text file is a collection of "lines", and a "line" consists of "zero or more characters + line breaks" (Qiita). Even in Ruby code, there's no reason why you shouldn't follow it (unless you do something weird). Even in C, code that does not end with a newline is not guaranteed to work properly.
――It's decided --An error may occur if there is no line break
It seems like that.