English
Bugs and vermeintliche

For-creep, Laufvariablen-Deklaration and Proc

 

Thomas
Zielinski
Hi,
I have not find can or it standing objectively nirgendwo. has me In any drop a couple nerves cost[ed].

Nutzt is a For-Loop within of/ one Proc, so must too The Laufvariable in this Proc Deklariert his and not ausserhalb.

the goes:
Declare number%[]
CLS
MACHVOLL
Print Str $(number%[4])
WaitInput
End

Proc MACHVOLL

    Declare i%
    For i%, 20
    number%[i%] = i%*128
    EndFor

ENDPROC


the is not. (Error Message Variable i% isn't Deklariert [or so similar])
Declare number%[], i%
CLS
MACHVOLL
Print Str $(number%[4])
WaitInput
End

Proc MACHVOLL

    For i%, 20
    number%[i%] = i%*128
    EndFor

ENDPROC


what so did i not find can: Do I to the For one "i% = 0" make if i% before a others worth having, or setting For the value for i% yourself?
 
XProfan X4
XProfan X4; Win10 x64
Der Kuchen ist eine lüge!
10/26/21  
 




Thomas
Zielinski
Thomas Zielinski (26.10.2021)
what so did i not find can: Do I to the For one "i% = 0" make if i% before a others worth having, or setting For the value for i% yourself?


One kurzer Test confirm: For setting the value the Laufvariable selbstständig back.

Völliges chaos causes then but:
Declare i%
i% = 5
For i%,i%, 20//,1
zahl%[i%] = i%//<-- Result is then 0
EndFor
 
XProfan X4
XProfan X4; Win10 x64
Der Kuchen ist eine lüge!
10/26/21  
 




RudiB.
well Yes ...Startwert (I%=5) EndWert (i%=5) Schrittweite=20 ??????
How should the well weg, or seh I there what integrally wrong ??

but the first entry is already very mekwürdig....one BUG ???
here's then well Roland demand....
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/26/21  
 




RudiB.
....and here's number%[ ] not declared...
 
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/26/21  
 




Georg
Teles
Well, the For expects evident a declared Variable ... if For within of/ one Proc stattfindet, must these there declared or at least transfer been his (as Parameter zB).

loudly Help is very the, what For...EndFor to the WhileLoop Loop can: a variable inside the For Loop inquire, so-called Laufvariable (naturally can inside the WhileLoop Loop the &loop use, with For-creep can hereon dispense, if one self The Variablenvergabe organisiert).

These Laufvariable becomes naturally for For Loop needed ... so went the, if The Variable global declared watts:
Declare i%, number%[]
CLS
MACHVOLL i%
Print Str $(number%[4])
WaitInput
End

Proc MACHVOLL

    Parameters i%
    For i%, 20
    number%[i%] = i%*128
    EndFor

ENDPROC


After the For Loop becomes The Variable inside the Proc yet the value keep, outside the Proc but again on 0 staid. here can only Roland with want explain, what in the background happens.
 
XProfan X2
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

10/26/21  
 




RGH
One kurzer Verweis on The Help:

important: The Schleifenzähler must local Variable his, d.h. tappt im dunkeln must in the procedure declared go, in the The FOR-Loop is. is tappt im dunkeln in the Hauptprogramm, must The Variable too there declared go.

(Delphi holds it to that example too so.)

Greeting Roland
 
XProfan X4
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
11/01/21  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.714 Views

Untitledvor 0 min.
Ernst05/29/22
ByteAttack05/20/22
Michael W.03/30/22
RudiB.11/18/21
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie