Hi there, Is there a way to have a multi-line stat...
# getting-started
a
Hi there, Is there a way to have a multi-line statement, a way to tell Kotlin that the statement continues on next line: I'd like to spread a long statement like the following over several lines:
Copy code
every { <http://myThing.do|myThing.do>() } returns 1 andThenThrows Exception("No way!") andThen 3 andThen 4
the line gets too wide, is there a way to continue it:
Copy code
every { <http://myThing.do|myThing.do>() } returns 1 
  andThenThrows Exception("No way!") 
  andThen 3 
  andThen 4
TIA!
s
I think your two options are to wrap the whole statement in parens:
Copy code
(every { myThing.execute() }
      returns 1
      andThenThrows Exception("No way!")
      andThen 3
      andThen 4)
or switch to a more postfix-looking style (which admittedly doesn’t look great)
Copy code
every { myThing.execute() } returns 
      1 andThenThrows 
      Exception("No way!") andThen 
      3 andThen 
      4
(or… technically, you could just not call the functions as
infix
😅)
👍 2