Differences

This shows you the differences between two versions of the page.


Previous revision
—let [2026/09/18 15:31] (current) – [See Also] jjflash
Line 1: Line 1:
 +======LET======
  
 +[pet] [vic20] [c64] [c16] [cplus4] [c128] [x16] [m65]
 +=====Syntax=====
 +
 +<code xcbasic>
 +[LET] <variable> = <expression>
 +</code>
 +
 +The ''LET'' command assigns the value of an expression to a variable.
 +
 +===== Examples =====
 +
 +<code xcbasic>
 +' DIM some variables and assign values to them
 +DIM x AS BYTE
 +DIM y(10) AS INT
 +LET x = 5
 +LET y(2) = x * 2
 +</code>
 +
 +In the above example, variable ''x'' is defined as a ''BYTE'' and ''y'' is defined as an ''INT'' array with ''11'' dimensional elements. Variable ''x'' is then assigned the value of ''5'' and variable ''y'''s second array element is assigned the value of the expression ''x * 2'', which evaluates to ''10'' in this example.
 +
 +<adm note>
 +''LET'' is an optional keyword and may be omitted when assigning values or expressions to a variable.
 +</adm>
 +=====See Also=====
 +  * [[DIM]]
 +  * [[operators]]
 +  * [[variables]]
 +  * [[syntax]]