pikasTech/PikaPython

Function Definition Not Working in PikaScriptShell

Closed this issue · 6 comments

In the script console, I can't seem to be able to define a function that will be executed later due to a syntax error (?)

>>> def a():
...    print("A")
...    print("B")
... 
[error]: Syntax error.
>>>
>>> a()
>>> 

This code works in a Python shell as regular.

>>> def a():
...    print("A")
...    print("B")
...
>>> a()
A
B

Aha, with 4 spaces instead of 3 (which python did not need), I can get a function definition but it still won't execute correctly.

>>> def a():
...     print("A")
... 
>>> a()
>>> 

function define is only supported in main.py

Should we leave this issue open as "Support function definition in pikaScriptShell?

Should we leave this issue open as "Support function definition in pikaScriptShell?

Okay, it can be a TODO issue for the next release version. #88

now it works 7e876c9

>>> def a():
...     print("A")
... 
>>> a()
A
>>>

Confirmed solved after update.