Language Core Definitions |
Top Previous Next |
LabTALK is an interpreter language based on the BASIC language. The task of this document is not to teach BASIC, but rather to point out the similarities and differences between it and LabTALK. Therefore the documents below assume that you have some general programming knowledge. Variables LabTALK can work with integer, float and string variables. There is no forward declaration of variables like in advanced languages (C, or Pascal..) The variable becomes the type as soon as you assign a value to it for first time. a = 10 will create integer variable 'a' b = 10.5 will create float variable 'b' name = "Hello!" will create string variable 'name'. If you need to enter '\' you need to do it like in the C language with double '\\' file = "c:\\myfile.txt" You can create your very first program quite easily: string = "Hello!" print string Then hit the Run button and watch the output tab: Arrays Arrays don't have to be declared as to type or number of elements. They all could be integer, float or string. myarray[0] = 10 myarray[1] = 20 Arrays in LabTALK can go even to negative: myarray[-1] = 10 is still valid. In fact you can mix various types within one array - but of course this is not advised and is of little benefit. The array index may be a constant, another variable or an expression. See the code below: a = 5 myarray[a] = 10 myarray[a+1] = 20 print myarray[6] The printed result is of course 20. Expressions LabTALK has fully developed integer and float expressions. b = 3 a = 3 + 2 * 5 + 4*(10+b*(23+b)) print a The result is 365. You can use expressions directly in any function. String operations LabTALK can use various string operations as well. See the code below: c = "Os"+"car" str = "Hello"+ CHR(32) + c + "!" print str Result is: Hello Oscar Comments Everything in a line after // is deemed to be a comment menu = MenuGetCurSel() // VTS menu 1..255, VMG menu 10001..10255 Whole line can be just a comment // ****** The loop starts here ******** You can comment block of the text with /* and */ /* This text is just a comment It will never run */ Language. The whole language can be divided into two parts. One are commands of the basic language - the definition of the language. The other part are functions that are specific to DVD-lab. CORE of language
Defined functions
|