%
This article is about the Simons' BASIC keyword %.
Type: modifier
Syntax: a = %11110000 (for example)
The % prefix allows the programmer to express a numeric constant in the binary numeral system. When the interpreter encounters the % prefix, it will recognize the number that follows as a binary number. The only accepted digits are 0 or 1, and the value must be within 0 and 255, inclusive. The number of digits must be 8. If the interpreter can't parse the given number, the
?NOT BINARY CHAR
error is displayed.
Example[edit | edit source]
PRINT "THE NUMBER %10010101 IS DECIMAL" %10010101
will output:
THE NUMBER %10010101 IS DECIMAL 149
% | $ | ANGL | ARC | AT | AUTO | BCKGNDS | BFLASH | BFLASH 0 | BLOCK | CALL | CENTRE | CGOTO | CHAR | CHECK | CIRCLE | CMOB | COLD | COLOUR | COPY | CSET | DELAY | DESIGN | DETECT | DIR | DISAPA | DISK | DISABLE | DISPLAY | DIV | DOWN (B/W) | DRAW | DUMP | DUP | ELSE | END LOOP | END PROC | ENVELOPE | ERRLN | ERRN | EXEC | EXIT | EXOR | FCHR | FCOL | FETCH | FILL | FIND | FLASH | FRAC | GLOBAL | GRAPHICS | HI COL | HIRES | HRDCPY | INKEY | INSERT | INST | INV | JOY | KEY | LEFT (B/W) | LIN | LINE | LOCAL | LOOP | LOW COL | MEM | MERGE | MMOB | MOB OFF | MOB SET | MOD | MOVE | MULTI | MUSIC | NO ERROR | NRM | OFF | OLD | ON ERROR | ON KEY | OPTION | OUT | PAGE | PAINT | PAUSE | PENX | PENY | PLACE | PLAY | PLOT | POT | PROC | RCOMP | REC | RENUMBER | REPEAT | RESET | RESUME | RETRACE | RIGHT (B/W) | RLOCMOB | ROT | SCRLD | SCRSV | SECURE | SOUND | TEST | TEXT | TRACE | UP (B/W) | UNTIL | USE | VOL | WAVE | @