Here - 1000 BiT

Here - 1000 BiT Here - 1000 BiT

11.07.2015 Views

LESSON 27SWITCHING NUMBERS WITH STRINGSThis lesson explains two functions: VAL( ) and STR$( ).MAKING STRINGS INTO NUMBERSWe have two kinds of variables: strings and numbers. We can change one kind into theother.Run10 REM STRINGS INTO NUMBERS20 PRINT'clr"30L$="123":M$="789"50 L=VAL(L$):M=VAL(M$)70 PRINT L72 PRINT M74 PRINT "76 PRINT L+MVAL stands for value. It changes a string to a number, if it can.152

MAKING NUMBERS INTO STRINGSRun10 REM NUMBERS INTO STRINGS20 PRINT "clr"21 POKE 53281,025 INPUT" GIVE ME A NUMBER ";NB30 N$=STR$[NB)35 L=LEN(N$)40FORI=LTO1 STEP-145B$=B$+MID$(N$,I,1)50 NEXT I60 PRINT "cyn dn HERE IT IS BACKWARDS dn"65 PRINT "dn";B$STR$ stands for string. It changes a number to a string.FUNCTIONS AGAINIn this book we use these functions:RND() INT()LEFT$() RIGHT$() MID$()VAL() STR$()ASC() CHR$() PEEK()LEN()153

MAKING NUMBERS INTO STRINGSRun10 REM NUMBERS INTO STRINGS20 PRINT "clr"21 POKE 53281,025 INPUT" GIVE ME A NUMBER ";NB30 N$=STR$[NB)35 L=LEN(N$)40FORI=LTO1 STEP-145B$=B$+MID$(N$,I,1)50 NEXT I60 PRINT "cyn dn HERE IT IS BACKWARDS dn"65 PRINT "dn";B$STR$ stands for string. It changes a number to a string.FUNCTIONS AGAINIn this book we use these functions:RND() INT()LEFT$() RIGHT$() MID$()VAL() STR$()ASC() CHR$() PEEK()LEN()153

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!