Jump to content

Syntax error with try a closure


Recommended Posts

Hi!

I try to do a closure.

Here, my code:

Func coef($c)
    Func valeur($v)
        Return $v*$c
    EndFunc
    Return valeur
EndFunc

$a=coef(1.25)
ConsoleWrite($a(1))
ConsoleWrite($a(2))
ConsoleWrite($a(100))

But, I have a syntax error on: Func valeur($v)

What is the problem?

Thank you for all answers.

Edited by Michel Claveau
Link to comment
Share on other sites

HI,

Func in a another Func is not possible.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

what do you want to do? Calculating what?

ConsoleWrite(coef(1, 1.25) & @CRLF)
ConsoleWrite(coef(2, 1.25) & @CRLF)
ConsoleWrite(coef(100, 1.25) & @CRLF)

Func coef($valeur, $c)
    Return $valeur ^ $c
EndFunc   ;==>coef

Mega

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

which pro do you miss? A closure is only a code block which can be a parameter for a function/method.

Or what feature is it that makes them interesting for you?

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...