Monday, July 31, 2023

🆕 RemoveLocalStorageItem and ClearLocalStorage

(Latest version of BASIC Anywhere Machine.)

Sample program to demo all of the local storage statements and function:

LET userName$ = GetLocalStorageItem("Prog1: userName" )

LET CountProgramRuns% = VAL( GetLocalStorageItem("Prog1: runCount" ) )  + 1
SetLocalStorageItem("Prog1: runCount" , CountProgramRuns%)

IF userName$ = "" THEN
    WHILE userName$ = "" : userName$ = _PROMPT(" Enter your user name", "") : WEND
    SetLocalStorageItem("Prog1: userName" , userName$)
END IF

PRINT "Hello, " + userName$
PRINT "This program has been run " + str$(CountProgramRuns%) + " times."

SLEEP 2
IF NOT _CONFIRM("Maintain your name in local storage?") _
   THEN RemoveLocalStorageItem("Prog1: userName")
   
IF _CONFIRM("Clear local storage?") _
   THEN PRINT "PRESS A KEY TO CLEAR LOCAL STORAGE": temp$ = INPUT$(1) : ClearLocalStorage


No comments:

Post a Comment

🖥 Flower Tesselation: Testing DRAW and recursive SUB's

This BAM program inspired by Richard Russell's "Flower-like tesselation" BBC BASIC program posted on Facebook . Created in ord...