def dp = debug pause

Post Reply
Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

def dp = debug pause

Post by Henko »

Why does this function definition result in a "syntax error" ??

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: def dp = debug pause

Post by rbytes »

This works fine

Code: Select all

dp 
END

DEF dp()
  DEBUG PAUSE
END DEF
I was not aware that you could use = to create a def
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: def dp = debug pause

Post by Mr. Kibernetik »

It is incorrect to use command instead of a function, but you can use commands inside a multi-line function.

It is an error to write LET A = DEBUG PAUSE because command is not a function. This is why you cannot substitute function with a command. But it is ok to use command in a multi-line user function which is just a sequence of commands.

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: def dp = debug pause

Post by Henko »

Thanks, mr. K, i understand.

@Ricardobytes: i use the abbreviation
DEF b_p(a$) = BUTTON_PRESSED(a$)
All the time. I hate typing. :lol:

Post Reply