Author Topic: Bug in Function ?????  (Read 35 times)

Alex

  • Newbie
  • *
  • Posts: 23
    • View Profile
Bug in Function ?????
« on: June 24, 2020, 07:27:35 PM »
In my computer both code do not run weel, with strangers messages

Align Strings
Code: [Select]
Var Test String
Test = Alinha("123,50",20)
Write "[", Test, "]"
Test = Alinha("1.523,50",20)
Write "[", Test, "]"
EndProgram

Function Alinha(S String, T Integer) String
Var StrAlinha String, Str String, Comp Integer
StrAlinha = S
Message "Aqui S = ",S," e StrAlinha = ",StrAlinha
Comp = StrLen(S)
 If T < Comp
  Return StrAlinha
 Else
  T = T - Comp
  Str = (SeqStr(T,".")
  Message "Aqui Str = ",Str," e S = ",S
  StrAlinha = JoinStr(Str,S)
  Return StrAlinha
 EndIf 
EndFunction


test I did
Code: [Select]
Var str1 String, str2 String, str3 String, str4 String
Var T Integer
str1 = "Ola"
str2 = " mundo"
str3 = JoinStr(str1,str2)
Write str3
str4 = Join(str2,str1)
Write str4
T = Sum(5, 2)
Write "The value of the sum of 5 + 2 is equals to ", T
Wait 3000
EndWindow
EndProgram


Function Join(s1 String, s2 String) String
Var st String
Message s1,s2
st = JoinStr(s1,s2)
Return st
EndFunction

Function Sum(X Integer, Y Integer) Integer
Var Ret Integer, V Integer
Ret = X + Y
Return Ret
EndFunction
« Last Edit: June 24, 2020, 07:31:20 PM by Alex »