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 7890055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:15:17+00:00 2026-06-03T06:15:17+00:00

What is be the best way to define method level variables scope? Some ColdFusion

  • 0

What is be the best way to define method level variables scope?

Some ColdFusion documents say it should be done like this:

 <cfset Var testVariable = "this is a local variable">

But others, do it like this:

<cfset LOCAL = StructNew() />
<cfset LOCAL.testVariable  = StructNew() />

Which way is better?

  • 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-06-03T06:15:18+00:00Added an answer on June 3, 2026 at 6:15 am

    Either will work.

    In CF9 (and I assume 10) var local = structNew() is unnecessary (though harmless and makes your code backward compatible) as there is within each function a local scope that contains any locally scoped values. Also with CF8 and earlier these variables will need to be the first thing declared in a function.

    So to specifically answer your question I prefer the var local = structNew() (or just var local={}) because:

    • It means that locally scoped variables are obviously such (var
      scoping issues can be a pain to debug).
    • You can dump or examine the
      local “scope” in cf 8.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What would be the best way to define a method in the model that
What is the best way to define a method signature when you have to
Can you suggest a best way to define money type in F#?
the best way to explain is with example so: this is the model public
The best way I can think of to ask this is by example... In
The best way of describing this is I have a table of people with
I am new to rails and am wondering if this is the best way
I can define an event like this(declared function): MyElement.Keyup +=MyDeclaredFunction I can also define
What is the best/standard way to define a web service interface? For example, I
I would like to do something like this: #define GETKEY (a) ([NSString stringWithFormat:@%d,a]) NSMutableDictionary

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.