davidcallanan/py-myopl-code

Help with print

jet2tlf opened this issue · 2 comments

I would like to know how I can add the following system:

input > PRINT("Hello World", 2)
output > Hello World 2

To do this you would need to add an infinite list of parameters in the execute_print function, wich is impossible

def execute_print(self, exec_ctx):
        print(str(exec_ctx.symbol_table.get("value")))
        return RTResult().success(Number.null)

    execute_print.arg_names = ["value"] # You would need to have infinite elements in this list

P.S: If you use *args the program will expect you to pass infinite parameters in the function, so it's useless

The only solution that i found was this. The only problem is that every element will be divided with a ',' (Comma):

VAR values = ["Hello World!", 2]
PRINT(values)

Output: Hello World!, 2

Reference

Well, it wasn't quite what I wanted but it solves the problem in quotes, thanks. <3