Group Abstract Group Abstract

Message Boards Message Boards

0
|
9.3K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Using Echo with Lexical Scoping Constructs

Posted 6 years ago
3 Replies

Maybe this does what you want?

DynamicModule[{tmp},
  Row[{ "tst1"
    , Spacer[4]
    , Slider[
        Dynamic[tmp
          , (tmp = #; Echo[tmp]) &
         ]
        , {1, 5, 1}
        , Appearance -> "Labeled", ImageSize -> "Small"]
      }
  ]
]
POSTED BY: Rolf Mertig

Hi Mike,

Apologies for the delayed response but many thanks for the great tips. I hadn't come across the programmatic notebook nor the in-built verification tests before.

Many thanks,

Archie

Posted 6 years ago

I have found that I can reduce (not eliminate) the need to debug my functions in this way by using unit tests as part of a more test driven approach.

Mathematica supports test driven approaches using a "Testing Notebook" under:

File | New | Programmatic Notebook

If you would rather keep your unit tests closer to your code, you can include VerificationTest

In addition to unit tests, I also find asserts and checks useful.

Thanks for the great question.

POSTED BY: Mike Besso
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard