Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6820533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:26:09+00:00 2026-05-26T21:26:09+00:00

In python there is the *args convention I am wondering if CF9 supports something

  • 0

In python there is the *args convention I am wondering if CF9 supports something similar.

Here is the python example

>>> def func(*args):
        for a in args:
               print a, "is a quality argument"


>>> func(1, 2, 3)
1 is a quality argument
2 is a quality argument
3 is a quality argument
>>> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:26:10+00:00Added an answer on May 26, 2026 at 9:26 pm

    Yes, CFML has supported dynamic arguments for as long as it has supported user-defined functions.

    All arguments, whether explicitly defined, or whether passed in without being defined, exist in the Arguments scope.

    The Arguments scope can be treated as both an array and a structure (key/value).

    Here is the closest equivalent to your example, using script syntax:

    function func()
    {
            for (a in arguments)
                   WriteOutput(arguments[a] & "is a quality argument");
    }
    

    Note that a in this example is the key name, not the value, hence why arguments[a] is used.

    To be treated as code, the above script must either be within <cfscript>..</cfscript> tags, or alternatively inside a component {..} block inside a .cfc file.

    Here’s a couple of tag versions, the first equivalent to the for/in loop:

    <cffunction name="func">
        <cfloop item="a" collection=#Arguments#>
            <cfoutput>#Arguments[a]# is a quality argument</cfoutput>
        </cfloop>
    </cffunction>
    

    And this one allows you to access the value directly (i.e. a is the value here):

    <cffunction name="func">
        <cfloop index="a" array=#Arguments#>
            <cfoutput>#a# is a quality argument</cfoutput>
        </cfloop>
    </cffunction>
    

    In Railo* CFML, this last example can be expressed in script as:

    function func()
    {
        loop index="a" array=Arguments
        {
            WriteOutput(a & 'is a quality argument');
        }
    }
    

    *Railo is one of two Open Source alternatives to Adobe ColdFusion, the other being Open BlueDragon.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a general convention about exposing members in Python classes? I know that
I have the following situation in my python code: class Parent(object): def run(self): print
I've been running a lot of similar commands lately, e.g. python foo.py some args
I am writing a python function with the following: class myObj(object): def __init__(self, args):
I'm wondering if there is a library like Boost Format, but which supports named
In Python there is a really neat function called zip which can be used
In Python there is a maximum recursion depth. Seems it is because Python is
in languages like PHP or Python there are convenient functions to turn an input
I'm looking for presence of an element in a list. In Python there is
In Python is there any way to make a class, then make a second

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.