• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X Scripting - Skill
  3. SKILL: "*Error* if: too many arguments (missing then?)"...

Stats

  • Replies 4
  • Subscribers 19
  • Views 102
  • Members are here 0
More Content

SKILL: "*Error* if: too many arguments (missing then?)" error on running "if" command

JuanCR
JuanCR 1 day ago

Check out the following statement:

if( order
        parameters = foreach( mapcar param order (get cdfgData param))
        parameters = (getq cdfgData parameters)
    )

It seems a then keyword is missing, and the tool does not complain.

Now let's say you add a printf command like:

if( order
        parameters = foreach( mapcar param order (get cdfgData param))
        parameters = (getq cdfgData parameters)
        printf("%L" parameters~>values)
    )

In this case, you'll get the following error:

*Error* if: too many arguments (missing then?) - 
(order (parameters = foreach(mapcar param order get(cdfgData param))) 
(parameters = (cdfgData->parameters)) printf("%L" (parameters~>values)))

Why did you get this error, and how can you fix it? I'll show you: 

Consider a simpler example. In the command line, type:

x = 2

Then enter this expression:

if( (x > 5) 1 0)

The tool will evaluate whether x > 5; if so, a "1" will be returned; otherwise, a "0" will be returned. Since 2 is less than 5, you will see the returned value as follows:

=> 0

This is because the "if" command falls into the following syntax:

if( g_condition g_thenExpression [ g_elseExpression ] )

Now, if a fourth argument is added ("3" in this case) as follows: 

if( (x > 5) 1 0 3)

You will now see the following error:

*Error* if: too many arguments (missing then?) - ((x > 5) 1 0 3)

You get it because the 'compact' form of the if command is no longer applied. The syntax now becomes:

if( g_condition then g_thenExpr1 ... [ else g_elseExpr1 ... ] ) 

Thus, you need to add a "then" for a complete "if" command. If it is not present, the tool will generate an error message.

It is recommended to use the "then" and "else" keywords to avoid such syntax errors and reduce confusion. There are times when the 'compact' form is handy without the bloat of then...else, but it is generally recommended to add these keywords.

Check the SKILL Language Reference for details. Here's an excerpt from the input for the if conditional:
 

Description

This command selectively evaluates two groups of one or more expressions. The syntax is as follows:

    if( g_condition g_thenExpression [ g_elseExpression ] ) 
    => g_result

The "if" form evaluates g_condition, typically a relational expression, and executes g_thenExpression if the condition is true (that is, its value is non-nil); otherwise, g_elseExpression is executed. The value returned by "if" is the value of the corresponding expression evaluated. The "if" form can therefore be used to evaluate expressions conditionally.

if( g_condition then g_thenExpr1 ... [ else g_elseExpr1 ... ] ) 
=> g_result

The second form of "if" uses the keywords "then" and "else" to group expressions into a conditional execution sequence. If the condition is true, the sequence of expressions between "then" and "else" (or the end of the if form) is evaluated, with the value of the last expression evaluated returned as the value of the form. If the condition is nil instead, the sequence of expressions following the "else" keyword (if any) is evaluated instead. Again, the value of the last expression evaluated is returned as the value of the form.

  • Sign in to reply
  • Cancel
Parents
  • DavidJHutchins
    DavidJHutchins 1 day ago

    Why doesn't the sklint tool report these issues?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • DavidJHutchins
    DavidJHutchins 17 hours ago in reply to DavidJHutchins

    below is the 'if_test' procedure I added as a test:

    C:\Users\davidh\Documents>cat -n test.il | tail
        42  )
        43  procedure(if_test()
        44      let((parameters param)
        45          if( order
        46              parameters = foreach( mapcar param order (get cdfgData param))
        47              parameters = (getq cdfgData parameters)
        48          )
        49      )
        50  )
        51

    C:\Users\davidh\Documents>il_allegro
    > sklint(?file "test.il")
    Loading skillLint.cxt
    INFO (LoadFile): Loading file C:\Cadence\SPB_23.1\tools\sklint/rules/allegro_sklint.il...
    INFO (LoadFile): Loading file C:\Cadence\SPB_23.1\tools\sklint/rules/hi2ipc.il...
    INFO (LoadFile): Loading file C:\Cadence\SPB_23.1\tools\sklint/rules/ignore.il...
    INFO (LoadFile): Loading file C:\Cadence\SPB_23.1\tools\sklint/rules/ilMig.il...
    INFO (REP008): Program SKILL Lint started on Sep 29 08:43:09 2026.
    INFO (PREFIXES): Using prefixes: "none"
    INFO (STRICT): Using strict checking of global variables.
    SUGGEST (REMOVE1): test.il, line 23 (PadStackUsage) : Consider use of remq rather than remove: remove(name PadTable)
    HINT (NTH1): test.il, line 35 (parse_test) : Can replace call to nth with call to caddr: nth(2 parseString(param_line "<>"))
    UNUSED VAR (Unused): test.il, line 44 (if_test) : variable param does not appear to be referenced.
    UNUSED VAR (Unused): test.il, line 44 (if_test) : variable parameters does not appear to be referenced. (assigned only)
    INFO (VAR5): Unrecognized global variables:
    WARN GLOB (VAR8): cdfgData
    INFO (VAR): used:  in function if_test from file test.il, lines (47 46)
    WARN GLOB (VAR8): order
    INFO (VAR): used:  in function if_test from file test.il, lines (46 45)
    INFO (IQ): IQ score is 74 (best is 100).
    INFO (IQ1): IQ score is based on 0 error messages, 4 general warning messages, and 3 top level forms.
    INFO (REP110): Total enhancement     : 0.
    INFO (REP110): Total external global : 0.
    INFO (REP110): Total package global  : 0.
    INFO (REP110): Total warning global  : 2.
    INFO (REP110): Total error global    : 0.
    INFO (REP110): Total unused vars     : 2.
    INFO (REP110): Total next release    : 0.
    INFO (REP110): Total alert           : 0.
    INFO (REP110): Total hint            : 1.
    INFO (REP110): Total suggestion      : 1.
    INFO (REP110): Total internal alert  : 0.
    INFO (REP110): Total information     : 19.
    INFO (REP110): Total warning         : 0.
    INFO (REP110): Total error           : 0.
    INFO (REP110): Total internal error  : 0.
    INFO (REP110): Total fatal error     : 0.
    INFO (REP009): Program SKILL Lint finished on Sep 29 08:43:09 2026 with status PASS.
    t

    no error reported...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • JuanCR
    JuanCR 15 hours ago in reply to DavidJHutchins

    Hi David, 

    Yes, this "if" statement is correct. You're following the syntax "if( g_condition g_thenExpression [ g_elseExpression ] )"

    See above, in the post. If you replace the contents of the "if" by this: 

    JuanCR said:
    if( order
            parameters = foreach( mapcar param order (get cdfgData param))
            parameters = (getq cdfgData parameters)
            printf("%L" parameters~>values)
        )

    then you'll see that sklint will flag the error.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • JuanCR
    JuanCR 15 hours ago in reply to DavidJHutchins

    Hi David, 

    Yes, this "if" statement is correct. You're following the syntax "if( g_condition g_thenExpression [ g_elseExpression ] )"

    See above, in the post. If you replace the contents of the "if" by this: 

    JuanCR said:
    if( order
            parameters = foreach( mapcar param order (get cdfgData param))
            parameters = (getq cdfgData parameters)
            printf("%L" parameters~>values)
        )

    then you'll see that sklint will flag the error.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information