Print Function

Action

Prints the values of expressions to the results file.

Syntax

Print (vaExprs)
Variable Description
vaExprs Any number of expressions. ANYTYPE.

Notes

  • Print prints the values of expressions to the results file. Print inserts a space between expressions.

  • When you pass arrays, lists, and records to Print, it separates the elements or fields with spaces and commas, and encloses the array, list, or record in braces. For example:
    [-] LIST lsDogs = {...}
    	[ ] "Greyhound" 
    	[ ] "Akita"
    	[ ] "Borzoi"
    [ ] Print (lsDogs) // Prints: {Greyhound, Akita, Borzoi}
  • If you attempt to print an uninitialized element of a list, array, or record, or a variable that has no value, Silk Test Classic prints the text "<unset>".

Example

[-] testcase PrintExample ()
	[ ] 
	[ ] Print ("The number", 1, "is in the middle") 
	[ ] // Prints: The number 1 is in the middle 
	[ ] 
	[ ] INTEGER iPercent = 30 
	[ ] Print ("Sales are up {iPercent} percent")
	[ ] //Prints: Sales are up 30 percent 
	[ ] 
	[ ] STRING sVar = "Value"
	[ ] Print ("'{sVar}' is {Len (sVar)} characters long") 
	[ ] // Prints: 'Value' is 5 characters long
	[ ] 
	[ ] LIST OF STRING lsFruit 
	[-] lsFruit = {...} 
		[ ] "Apple" 
		[ ] "Peach" 
		[ ] "Pear" 
	[ ] Print (lsFruit) 
	[ ] // Prints: {Apple, Peach, Pear} 
	[ ] 
	[ ] LIST OF POINT lPoint = {}
	[ ] ListAppend (lPoint, {1, 5})  
	[ ] ListAppend (lPoint, {4, 8}) 
	[ ] Print (lPoint)
	[ ] // Prints: {{1, 5}, {4, 8}} 
	[ ] 
	[ ] INTEGER aiCount[3] 
	[ ] aiCount[1] = 4 
	[ ] aiCount[3] = 9 
	[ ] Print (aiCount) 
	[ ] // Prints: {4, <unset>, 9}