Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fixed STRING variables or better say semi-variables
#1
Hi friends
here I share just some thinking about variable of type STRING and of FIXED lenght

in QBasic and in QB64 is possible to create variables of type STRING with a fixed lenght.
wiki di STRING

There is some little differences between STRING and FIXED STRING.
1. The last type cannot be initializated as a void string o null string because it must keep its fixed dimension.
2. the fixed string cannot add value in tail because it must keep its fixed dimension
so in runtime it cannot recursively modify itself 

please run this code to get the experience of this behaviour
Code: (Select All)

Dim a As String * 8, b As String, c As String * 2, d As Integer
' initialization to a void/null string
a = ""
b = ""
c = ""
Print "    a          c            b"
Print ">" + a + "<", ">" + c + "<", ">" + b + "<"

' filling the string variable
For d = 1 To 10
    a = a + LTrim$(Str$(d))
    c = c + LTrim$(Str$(d))
    b = b + LTrim$(Str$(d))
Next d
Print ">" + a + "<", ">" + c + "<", ">" + b + "<"
End

Can be this enough interesting to note into wiki of STRING?

thanks for feedbacks
Reply


Messages In This Thread
Fixed STRING variables or better say semi-variables - by TempodiBasic - 12-14-2024, 07:52 PM



Users browsing this thread: 2 Guest(s)