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

  • Home
  • SEARCH
  • 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 4347406
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:18:07+00:00 2026-05-21T12:18:07+00:00

So, I am testing somethings out, and have a test proc like so: proc

  • 0

So, I am testing somethings out, and have a “test” proc like so:

proc test {arg} {
    global state
    puts "Your arg is: $arg"
    set state 1
}
test somearg
vwait state

From reading about uplevel and upvar, is there a way that I can get away with not having to use global, and use either one of those options to set the state to “1” and then exit the program?

  • 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-21T12:18:08+00:00Added an answer on May 21, 2026 at 12:18 pm

    Yes, except that vwait always uses global variables for waiting on (strictly, it resolves variable names in the global scope; you can use other namespaces if you provide qualified names). What you can’t do is wait on a local variable (because events can’t see local variables outside their own call stack). Maybe this will change in the future, but certainly not now.

    In relation to the question about global, these statements are all the same in effect inside a procedure:

    global foo
    variable ::foo
    upvar #0 foo foo
    upvar ::foo foo
    namespace upvar :: foo foo
    

    You also have a bug in your code: you set the state before waiting for it to change. That won’t work anyway because you’ve got to wait first, and set the state from within some kind of event.

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

Sidebar

Related Questions

I am just starting out with unit testing and have a scenario I'm not
I have code very similar to this but cannot work out how I test
I have something like: string result = Selenium.GetText(/html/body/form/div[2]); if (result.Contains(test) { bool found =
All: I have a unit test that is testing functionality that requires an input
Testing out someone elses code, I noticed a few JSP pages printing funky non-ASCII
Duplicate: Testing a website for cross-browser/multiple-version support How do you test visual components I
I have a simple test file, TestMe.cpp: #include <gtest/gtest.h> TEST(MyTest, SomeTest) { EXPECT_EQ(1, 1);
I've been testing out the new functionality of html5 and js to create a
While testing out a UDP multicast server that I've written on Windows 7 Ultimate
I have a very simple test page that uses XHR requests with jQuery's $.getJSON

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.