syntax error, Unexpected ( Arg, expecting end-of-input )

Asked

Viewed 116 times

1

I came across this syntax error:

syntax error, Unexpected ( Arg, expecting end-of-input )

larguraDaLinha = 40
str = '--> text <--'
puts str.ljust  larguraDaLinha
puts str.center larguraDaLinha
puts str.rjust  larguraDaLinha
puts str.ljust (larguraDaLinha/2) + str.rjust (larguraDaLinha/2)

https://repl.it/KtDA/0

1 answer

1


Missing parentheses in function calls. Try to keep code organized and within a pattern, so avoid errors like this.

larguraDaLinha = 40
str = '--> text <--'
puts str.ljust(larguraDaLinha)
puts str.center(larguraDaLinha)
puts str.rjust(larguraDaLinha)
puts str.ljust(larguraDaLinha/2) + str.rjust(larguraDaLinha/2)

Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.

  • Thanks for the tip.

  • @shxrk see the [tour] the best were to say thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.