Jump to content

Recommended Posts

Posted

Hello :bye:! This thread is dedicated for the wiki page named "Best coding practices". You can post any issues, comments & suggestion here... This thread is useful if:

1. You are busy & you want someone to fix it.

2. You lack the knowledge to fix it.

3. You can't understand wiki syntax.

That wiki page contains *so much* potential but it needs some attention, love & care!

 

Please include as much information as possible before posting your issue or comment or suggestion. TD :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted

Why do you think this prefix is "missing"?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)

@water I saw it used in For loops contained in For loops, like this:

For $i = 0 To UBound($aArray)
    For $j = 0 To $iNumber
        ; Code
    Next
Next

I saw that in Array.au3 IIRC, TD :)

Edited by TheDcoder
code mistake

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted

A little thing for you to think about:
If "j" is the prefix, what is the name of the variable?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Want I want to tell you with my previous post:

I had a look at Array.au3 and there is the use of $i and $j when processing a 2D array.
"j" can't be a prefix because there is no name after the prefix. $sText is a variable named according to the Hungarioan Notation.  $j isn't.

To loop through an array you need an index variable. That's why $i is used for the first dimenstion (short form of Index). For the second dimension the next letter ($j) is used.
The variable isn't named based on the Hungarian Notation.

Hence nothing is missing in the wiki.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

why not $a1 , $a2 ?
In loop in loop I write it like this:
 

for $a1 = 1 to 10
    for $a2 = 1 to 10

    next
next

The number after the "a" represents the deep level of the loop. why a? no a special reason. it is because a is the first letter

Posted (edited)

because using $asomeothername you must be according to BCP (BestCodingPractice) and variable naming

so you can use

for $i1 = 1 to 10
    for $i2 = 1 to 10

    next
next

 

as this is integer not array

EDIT:

but I prefer something like this:

For $iClient = 1 To 10

    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part

    For $iDocument = 1 To 10

    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part

        _someFunction($iClient, $iDocument)

    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part
    ; some code part

    Next

Next

as in this way when the code is big so you can easily understand what mean $iClient and of course $i1 $i2 should be dicfficult to understand without going uppppppp...... and see where it is used first time.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I always used $i, $j and $k without any further thinking (I never had to), but recently I had to use another variable in a deeper loop, maybe $l, but it doesn't looks right to me, so I realized I have to use meaningful names for the For loop counters.

Currently I prefer mLipok's suggestion, because:
1. It's meaningful and it won't get complicated with some complex loop body.
2. You won't run out of variable names ($i, $j, $k, $l, $m, .... $z, what next?!).
3. It's meaningful and it won't get complicated with some complex loop body.

Posted

Is 1. and 3. the equivalent to While / WEnd :)

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I can say $i $y ... $z are like "magic numbers" , at least for me.

 

 

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I do not rember where but realized that for Loop conunters I saw such a naming solution:

For $iCntClient = 1 To 10

    ; some code part

    For $iCntDocument = 1 To 10

    ; some code part

        _someFunction($iCntClient, $iCntDocument)

    ; some code part

    Next

Next

where ...Cnt.... is for to distinguish it is a loop counter

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Prefixes are fine, as I they are based on the list we use in AutoIt.

I am however curious to why you think the wiki pages needs alot of attention? What do you feel is missing?

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

@guinness  There are 3 main reasons, 1 is there is a new (production) version which has a new data type called "Tables Map" IIRC, 2nd is that it looks like a bit outdated & hard for beginners to understand, 3rd is that we should aware new (& some old) users of AutoIt so that they can get the most out of it... TD :)

Edited by TheDcoder
Got the wrong variable from brain's memory stack

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted

The wiki entry is new and I think you're talking about the Map data structure, which isn't stable enough, even though Jon left it there for people to test. Also I am more aware of what the language has and will have, even for old users like me. Comments like that really get me, as I am one of many users (old) who want to use the new features of AutoIt and not be stuck with syntax from a version that was two or three releases ago.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Developers
Posted

@theDcoder, maybe you need to slow down a little on all the initiatives you are taking on as you are clearly way out of your league when it comes to these kind of topics. There is quite a group of active people that are taking care of these topics already and do not really need this.

I am closing this thread as it hasn't brought what is was intended for and won't anymore either.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Jos locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...