Next freebie in 28 Hours*
Before starting with visuals, we must first learn how to get the output in plain text. This is possible with the help of functions. Once we declare a function, we can call it any number of times within the same program and get the work done is short time. For now we'll just focus on a simple syntax for printing any text on the output panel by using the keyword 'trace'.
We must always be aware of the code's syntax before using it in the program. Now, we know that trace is used for typing the text but we must follow the correct syntax or the command won't work. The word trace must be followed with (), where single or double quotes are included within the parenthesis. The text that is to be printed must be between these quotes. Finally, end the line with semicolon (;). It is a must for every line to end with a semicolon if it is not continued further. We can write any number of trace commands within a program. The general syntax for trace is trace("02 Rocks!!!!");. The text inside can be a character or string.
This is the basic step for producing output and is used in almost every program. You must have "trace" down pat before going to the next video because it is also widely used in the visual programs: you don't want to commit mistakes while writing the syntax for trace (you'll make enough other errors, we all do – and we all use "trace" to find them!) There are few more things you should know about the trace syntax. You must be very specific about the data type that is declared and assigned when you're dealing with variables. This was discussed earlier as well. After watching this video, you must be able to get the desired text output at will. Practice this at least once before moving to the next video: can you output a single line joke?
Have a question but don't want to ask it publicly? If you are a prime member just ask right here and we will get back to you within 48 hours. Not prime yet? no worries you can ask publicly below.