|
Post by davidk64 on Jun 6, 2022 1:46:58 GMT
These are discussed in the HTML help topic "Numbers and Strings" under Mathematics section.
Here's the explanation code:
'Let's evaluate some code that produces a non-numeric result
a$(0) = "zero"
a$(1) = "one"
a$(2) = "two"
code$ = "a$(int("+str$(rnd(1))+"*3))"
print "We will evaluate the code: "; code$
result$ = eval$(code$)
print result$
'Now let's use the eval function, which effectively does a
'val() to the result of the calculation. Converting a non
'numeric string to a numeric value results in zero.
result = eval(code$)
print result
When I run it I get "BASIC Compile Halted: Type Mismatch. Array eval$() requires numeric parameters."
Is that what is supposed to happen?
Also are they "supposed" to be in the command reference "D-F" section?
|
|
|
Post by plus on Jun 6, 2022 17:04:01 GMT
JB is thinking eval$() is an array since you are showing an eval$() function, same problem will occur with eval() no $ sign. Do you have code for eval() or eval$() functions?
WT??
code$ = "a$(int("+str$(rnd(1))+"*3))"
|
|
|
Post by plus on Jun 6, 2022 17:15:50 GMT
This it?
a$(0) = "zero" a$(1) = "one" a$(2) = "two" code$ = "a$(" +str$(int(rnd(1)*3)) + ")" print "We will evaluate the code: "; code$ print a$( val( mid$(code$, 4)) )
|
|
|
Post by plus on Jun 6, 2022 17:21:57 GMT
Oh I see! This may be in Liberty Basic but it sure ain't in Just Basic! One way you can tell is when typed into the IDE eval should change color if it were an official keyword, it doesn't therefore it's not.
|
|
|
Post by davidk64 on Jun 6, 2022 21:26:56 GMT
Ah! Yes I see it is black like a$. Thanks for that +
|
|