txt: ## is-dynamic.md
  is dynamic
  
  Combined from primary sources listed below.
  
  # [In Variable](#___top "go to top of document")[§](#(Variable)_trait_is_dynamic "direct link")
  
  See primary documentation
  [in context](/type/Variable#trait_is_dynamic)
  for **trait is dynamic**.
  
  ```raku
  multi trait_mod:<is>(Variable:D, :$dynamic)
  ```
  
  Marks a variable as dynamic, that is, accessible from inner dynamic scopes without being in an inner lexical scope.
  
  ```raku
  sub introspect() {
      say $CALLER::x;
  }
  my $x is dynamic = 23;
  introspect;         # OUTPUT: «23␤»
  {
      # not dynamic
      my $x;
      introspect()    # dies with an exception of X::Caller::NotDynamic
  }
  
  ```
  
  The `is dynamic` trait is a rather cumbersome way of creating and accessing dynamic variables. A much easier way is to use the `* twigil`:
  
  ```raku
  sub introspect() {
      say $*x;
  }
  my $*x = 23;
  introspect;         # OUTPUT: «23␤»
  {
      # not dynamic
      my $x;
      introspect()    # dies with an exception of X::Dynamic::NotFound
  }
  
  ```
  