Search code examples
lua

Why is print() in Lua behaving like This?


In Lua interpreter when I type

>print (12 
>>3)

stdin:2: ')' expected (to close '(' at line 1) near '3'

Why am I getting this error?

When we type

>a=2 
>a=a+ 
>>1

This works fine! Then why not print? What is wrong with print()?


Solution

  • The input is print (12 <NEWLINE> 3), which is a syntax error.

    Adding a comma after 12 works fine.