[RUBY] Why put a line break at the end of the file

I thought I was writing a Ruby program, so I made a note.

Why do you put a line break on the last line?

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.

Setting to insert automatic modification when saving a file with VS Code

  1. Open Settings in Toolbar> Code> Preferences> Settings
  2. Search for "insert newline"
  3. Check the "Files: Insert Final Newline" item

Recommended Posts

Why put a line break at the end of the file
Read the file line by line VS read at once
Avoid matching * path at the end of routes.rb when accessing the URL of the [ActiveStorage] file
I learned about the existence of a gemspec file
Is there a performance difference between Oracle JDK and OpenJDK at the end of 2017?
I took a peek at the contents of Java's HashMap
Put the file in the properties of string in spring xml configuration
String Replacement of the case where the regular expression * of the character string search condition contains a line break.
A solution to the problem of blank spaces at the beginning of textarea
[Ruby] Insert, replace, destroy at the end of the character string [b021]
I took a look at the resources of Azure Container Instance
Get the public URL of a private Flickr file in Java
[chown] How to change the owner of a file or directory
I made a tool to output the difference of CSV file
[Ruby] Specify the argument name of the method. Meaning of the colon (:) at the end
Replace the contents of the Jar file
Put a badge on the icon
A memorandum of the FizzBuzz problem
It's almost the end of the year, so it's a story of cleaning up to use Docker comfortably at the beginning of the year
The story of forgetting to close a file in Java and failing
How to run a GIF file from the Linux command line (Ubuntu)
Create a Tokyo subway map from the CSV file of station data.jp
Draw a bar graph and a line graph at the same time with MPAndroidChart
Sample program that returns the hash value of a file in Java
How to change the value of a variable at a breakpoint in intelliJ
Create a jar file with the command
Why does Java call a file a class?
Find the difference from a multiple of 10
[Thymeleaf & Spring] Error caused by not putting / at the end of meta tag
Let's take a look at the functions of Keycloak's management console (administrator edition)