Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

new line in ruby

str = "hello world"
str_with_new_line = "hello world/n"

# You also can output values differently
# 1. print
# Outputs the value with no new line
# 2. puts 
# Outputs the value with new line

str1 = "hello"
str2 = "world"

puts str1
puts str2

# Output: hello
#         world


print str1
print str2

# Output: helloworld
 
PREVIOUS NEXT
Tagged: #line #ruby
ADD COMMENT
Topic
Name
7+6 =