--- title: "VAL$ (2068)" type: "article" slug: "val-2068" url: "http://localhost/article/val-2068/" markdown_url: "http://localhost/article/val-2068.md" published_at: "2022-10-07T12:24:35+00:00" modified_at: "2026-08-09T14:17:53+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "You will recall that at the NOV. meeting there was a discussion on the use of VAL$. Robert Ryan actively entered into the discussion, and offers this further demonstration. This program is a short demonstration of one use for VAL$. It inputs a name and then will print the first, last or middle name from…" category: - name: "The Plotter" slug: "the-plotter" taxonomy: "category" url: "http://localhost/category/periodicals/the-plotter/" post_tag: - name: "Best of Timex/Sinclair 2068 Articles and Documents" slug: "ts2068best" taxonomy: "post_tag" url: "http://localhost/tag/ts2068best/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" basic: - name: "VAL$" slug: "val-2" taxonomy: "basic" url: "http://localhost/basic/val-2/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" volume: "4" issue: "4" issues_articles: - id: 39436 title: "The Plotter v4 n4" type: "issue" url: "http://localhost/issue/the-plotter-v4-n4/" pages: "5" pubdate: "April 1986" archive_link: false --- # VAL$ (2068) You will recall that at the NOV. meeting there was a discussion on the use of VAL$. [Robert Ryan](http://localhost/indiv/robert-ryan/) actively entered into the discussion, and offers this further demonstration. This program is a short demonstration of one use for VAL$. It inputs a name and then will print the first, last or middle name from it. Lines 10-30 tell the computer how to get first, last, and middle names. Line 50-80 find where the breaks in the name are. Then line 98 finds out which name you want to print. When line 100 is executed the computer first tries VAL$ (z$+”$”). Depending on whether z$ is f, l, or m, VAL$ (z$+”$”) will be equal to the contents of string f$, l$, or m$, namely a$(a+3 TO b), a$( TO a), or a$(b+2 T0) so VAL$ VAL$ (z$+”$”) will be equal to the contents of a$(a+3 T0 b), a$( TO 0), or a$(b+2 TO ), namely the first, last or middle name from the name entered. VALs behaves as if replaced by the contents of its argument, for example: ``` 10 LET B$="A$ (2 TO )" 20 PRINT VAL$ (B$) ``` Thus VAL$(B$) would be the same as A$ ( 2 TO ) ``` 10 LET f$="a$ ( a$+3 TO b)" 20 LET l$="a$( TO a)" 30 LET m$="a$(b+2 TO )" 40 INPUT "Name (Last, First, Middle)", LINE a$ 50 FOR i=1 TO LEN a$ 60 IF a$(i)=" " THEN LET b=i-1 70 IF a$(i)="," THEN LET a=i-1 80 NEXT i 90 INPUT "Print f)irst, l)ast, m)iddle name"; z$ 100 PRINT VAL$ VAL$ (z$+"$") 110 GO TO 90 ```