{"id":5474,"date":"2023-11-20T15:10:41","date_gmt":"2023-11-20T14:10:41","guid":{"rendered":"https:\/\/msxitalia.org\/?p=5474"},"modified":"2023-11-20T15:10:41","modified_gmt":"2023-11-20T14:10:41","slug":"msx-basic-lezione-3","status":"publish","type":"post","link":"https:\/\/msxitalia.org\/en\/msx-basic-lezione-3\/","title":{"rendered":"MSX BASIC \u2013 lesson 3"},"content":{"rendered":"<div>\n<div class=\"\" dir=\"auto\">\n<div id=\":r49d:\" class=\"x1iorvi4 x1pi30zi x1swvt13 xjkvuk6\" data-ad-comet-preview=\"message\" data-ad-preview=\"message\">\n<div class=\"x78zum5 xdt5ytf xz62fqu x16ldp7u\">\n<div class=\"xu06os2 x1ok221b\">\n<div class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">\n<h1 dir=\"auto\"><img decoding=\"async\" data-src=\"https:\/\/msxitalia.org\/wp-content\/uploads\/2023\/11\/Corso-Basic-MSX1-OC-300x225.jpg\" class=\"size-medium wp-image-5338 aligncenter lazyload\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" alt=\"\" width=\"300\" height=\"225\" \/><noscript><img decoding=\"async\" class=\"size-medium wp-image-5338 aligncenter\" src=\"https:\/\/msxitalia.org\/wp-content\/uploads\/2023\/11\/Corso-Basic-MSX1-OC-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\"><\/noscript><\/h1>\n<h1 dir=\"auto\" style=\"text-align: center;\">\u201cMSX BASIC\u201d COLUMN by Orazio Cacciola (part 3)<\/h1>\n<h2>PRINT USING<\/h2>\n<p>As mentioned last time, I will talk about PRINT USING or formatted printing. This function allows you to specify the print format using special characters.<\/p><\/div>\n<div><\/div>\n<h3 class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">They can be variables, constants or sentences<\/h3>\n<div class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">The correct syntax is PRINT USING \u201cFORMAT STRING\u201d; Topic1; Topic2; \u2026..<br \/>\nI will first specify special characters for alphanumeric phrases or variables;<br \/>\n\\ \\: Print the string variable for spaces that have been used.<br \/>\nExample: N$=\u201dOrazio Cacciola\u201d, my first and last name is 15 characters long including the space.<\/div>\n<div><\/div>\n<div class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">If we want to print only my name which is made up of 6 characters, we will use the backslash (\\), 4 spaces and the backslash again. The more spaces we use, the more characters will be displayed.<\/div>\n<div class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">The correct syntax is: PRINT USING \u201c\\ \\\u201d; N$<\/div>\n<div class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">\n! : Prints only the first character of the sentence<br \/>\nPRINT USING \u201c!\u201d; N$ will only print the capital O of my name<\/div>\n<div class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">\n&amp; : Print the complete string phrase or variable. Example above: PRINT USING \u201c&amp;\u201d;N$<br \/>\nwill print the complete sentence.<\/div>\n<h3 class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">\nSpecial characters for variables or constants<\/h3>\n<p class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\"># : Prints the number of positions before and after the decimal point Example: A=10.1: PRINT USING \u201c##.##\u201d; A. It will print 10,10, because we told it to print 2 numbers before the decimal point and 2 after it. If the number is larger than the format we used, it will still print it by putting the percent sign (%) in front. This only applies<br \/>\nfor values above the decimal point, while those after are rounded.<br \/>\n+ or \u2013 : Placed at the beginning of the format string it will display the positive or negative sign of the variable.<br \/>\n\u2013 : Placed after the format string appears at the end of the variable<br \/>\n$ : Placed at the beginning it is displayed before the variable<br \/>\n** : Places many asterisks to the left of the variable for the entire length of the field.<br \/>\n**$ : As above plus adds the symbol $ before the variable<br \/>\n, : Putting before the decimal point ensures that it will be printed every 3 places of the decimal number. Example: A=1055.80: PRINT USING \u201c####,.##\u201d;A Will print 1,055.80<br \/>\n^^^^ = Placed at the end of the format string, the variable will be represented in the form of scientific notation<\/p>\n<p>And finally you can combine sentences and numbers within the format string, just leave a space, both before and after.<br \/>\nLet&#039;s use the example from before by adding only the sentence.<br \/>\nPRINT USING \u201d Euro ####,.##\u201d;A Will print &#039;Euro 1,055.80 or<br \/>\nPRINT USING \u201c####,.## Euro\u201d;A Will print 1,055.80 Euro<\/p>\n<p class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">Small dilemma. I noticed that in some manuals instead of the $ (dollar) sign they use the \u00c2\u00a3 (Lira) sign, but trying with the Philips, the first one is the correct one. Perhaps, at the time other manufacturers set the second as a special character.<\/p>\n<p class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">If anyone is informed about this dilemma, write it in the comments, to clarify.<br \/>\nAnd that&#039;s it. Until next time<br \/>\nOrazio Cacciola<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>RUBRICA &#8220;MSX BASIC&#8221; a cura di Orazio Cacciola (parte 3) PRINT USING Come accennato la volta scorsa, parler\u00f2&#8217; del PRINT USING o stampa formattata. Questa funzione permette ti specificare il formato di stampa mediante dei caratteri speciali. Possono essere variabili, costanti o frasi La sintassi corretta \u00e8 PRINT USING &#8220;STRINGA FORMATO&#8221;; Argomento1; Argomento2; &#8230;.. Specificher\u00f2&#8217; [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[14],"tags":[],"dipi_cpt_category":[],"class_list":["post-5474","post","type-post","status-publish","format-standard","hentry","category-msx-basic"],"_links":{"self":[{"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/posts\/5474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/comments?post=5474"}],"version-history":[{"count":2,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/posts\/5474\/revisions"}],"predecessor-version":[{"id":5476,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/posts\/5474\/revisions\/5476"}],"wp:attachment":[{"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/media?parent=5474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/categories?post=5474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/tags?post=5474"},{"taxonomy":"dipi_cpt_category","embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/dipi_cpt_category?post=5474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}