Virata manual

local

Stores a piece of text or a number under a name, for the session.

What we have

  • local x 5 for text and local x = 2+3 for the value
  • ` x' ` to use it, and =2+3' `` evaluated inline
  • foreach and forvalues set it, inside a do-file

Coming later

  • the extended macro functions, such as ` : word count ...' ``

You may shorten it to loc.

How you write it

local name value   |   local name = expression

Square brackets mean optional. A vertical bar means choose one.

What it does

A macro: somewhere to keep a list of variables or a cut-off so it is written once and used many times. You put it in with local, and take it out by wrapping the name in a backtick and an apostrophe: ` controls' ``.

The = matters. local x = 2 + 3 works the sum out and stores 5; local x 2 + 3 stores the three characters "2 + 3" and leaves the arithmetic for later. Both are useful; confusing them is a classic afternoon lost.

Try it

. local x = 2 + 3
. display `x'
5

Nearby

set log help manual recipe display