Learn to Code via Tutorials on Repl.it!

← Back to all posts
use of raw strings
AnishChaudhary

kotlin: use of raw strings
raw string means it has three quotes
please insert double quote two times inside the first double quote and press enter
code is down below :
//
//
fun main(){
val anish="""
hello bro
what's up
using stackoverflow
lol, bottle
""".trimMargin()
println(anish)
}
//raw strings , raw strings have triple quotes , as a result it contains new line , the reason of using this is to use the variable single time
//trim margin is used to remove the whitespace from the rawstrings

Voters
AmoghTheCool
AnishChaudhary
Comments
hotnewtop
AmoghTheCool

kewl and interesting read! Also to make code in markdown use triple backtails (`) like so:

AnishChaudhary

@AmoghTheCool great bro , this was my first post.i thought placing semicolon would just break the code , but i was wrong.

AnishChaudhary

edit:
please insert double quote two times inside the first double strings and press enter