Search found 72 matches

by matt7
Sat Jan 16, 2021 3:29 pm
Forum: Other topics
Topic: Format string with PRINT command
Replies: 3
Views: 43

Re: Format string with PRINT command

Here's another option that builds the format string from right to left and then applies it.

Code: Select all

def fmt$(a)
f$="###"
m=1000
while abs(a)>=m
f$="###,"&f$
m*=1000
endwhile
return str$(a,f$)
enddef
Add a trim$() to the return line or whenever you call fmt$ to remove leading spaces.
by matt7
Thu Jan 07, 2021 9:46 pm
Forum: Other topics
Topic: New version has wrong number?
Replies: 7
Views: 331

Re: New version has wrong number?

Here is a thread discussing some different ways to achieve select-case functionality:
https://www.kibernetik.pro/forum/viewto ... =26&t=2387
by matt7
Wed Dec 09, 2020 8:22 pm
Forum: Other topics
Topic: Copy files between BASIC v6 and other apps
Replies: 20
Views: 679

Re: Copy files between BASIC v6 and other apps

In 'Files' I can only see 'GoodReader' as a target for sharing. This is an app that has been on my iPad for years and is systematically updated. So in principle the sharing facility seems possible in iOS 12.4.9 I just wanted to share a puzzling thing I noticed on my iPhone that was on iOS 13.6 at t...
by matt7
Wed May 15, 2019 11:53 am
Forum: Other topics
Topic: Case Statement
Replies: 10
Views: 239

Re: Case Statement

what happens if dayno is anything but 0 through 6? Good point. I don't use GOTOs and labels very often so it slipped my mind, but if you want to detect the error case you can right under the ON GOTO line. (In my earlier example without error handling, any "invalid" dayno would fall through to d1, c...
by matt7
Mon May 13, 2019 3:50 pm
Forum: Other topics
Topic: Case Statement
Replies: 10
Views: 239

Re: Case Statement

I notice that in some of the previously posted examples, arrays smaller than 10 are being dimensioned. That is not necessary in Smart Basic. True. I didn't even think about that, since I prefer to just DIM every array for clarity so that I know how many array elements I'm intending to use (a lot of...
by matt7
Sun May 12, 2019 5:50 pm
Forum: Other topics
Topic: Case Statement
Replies: 10
Views: 239

Re: Case Statement

Btw, you may have only used the dayno and day$ example to simplify your question for the forum, but for that specific example, using a string array would be much simpler than a case statement. OPTION BASE 1 DIM dayArr$(7) dayArr$(1) = "Monday" dayArr$(2) = "Tuesday" dayArr$(3) = "Wednesday" dayArr$(...
by matt7
Sun May 12, 2019 5:28 pm
Forum: Other topics
Topic: Case Statement
Replies: 10
Views: 239

Re: Case Statement

This is how I switch on a variable value. The main downside is that is a little messy and annoying to keep track of how many END IFs I need at the end, but the main reason to use this style is to avoid accumulating indents with each "ELSE IF". IF a = 1 THEN ' do something ELSE ! IF a = 2 THEN ' do s...
by matt7
Tue Apr 16, 2019 2:29 pm
Forum: Other topics
Topic: Update to Smart Basic?
Replies: 17
Views: 286

Re: Update to Smart Basic?

Add me to the list of people who would rather have bug fixes and continued support than Dropbox support. And I would pay a few bucks a month too if it was needed to keep the app going. I like the syntax improvements that are being discussed for the new Basic, but the fact that it is not likely to ma...
by matt7
Mon Apr 08, 2019 4:23 am
Forum: Other topics
Topic: No alphabetic order of sB-files and folders
Replies: 2
Views: 69

Re: No alphabetic order of sB-files and folders

Unfortunately, there is no fix to this issue (that I know of). I recommend organizing your files in a folder structure so that the number of sub-folders and files in any given folder is a manageable number. Basically, keep the number low to avoid having to scroll through and search long, unordered l...
by matt7
Mon Mar 25, 2019 7:37 pm
Forum: For beginners
Topic: Help with BUTTONS, SWITCHES and SLIDERS, PLEASE.
Replies: 9
Views: 2694

Re: Help with BUTTONS, SWITCHES and SLIDERS, PLEASE.

It's also worth mentioning that any interface object you create is added to a "page." If no page is manually set up (like in my example above), then Smart Basic puts the interface object onto the default page (with name "") that has a transparent background and covers the entire screen. But if you s...