Various code questions
#1
I have a few assorted pieces of code that I don't really understand, and I'm wondering if anyone can help explain or break down what the code means.


1) 

Code: (Select All)
variable~&(1)

I know the & symbol means long integer, but is "~" part of the variable name or is this part of the variable type?



2)
Code: (Select All)
Do: _Limit 10
Loop Until Len(InKey$)

Obviously the point of this is "press a key to continue" but the code is not familiar to me.   Do followed by :  is a new one, and I'm not sure what _Limit 10 is doing on this line.
Additionally "Loop Until" is normal stuff but having Len(Inkey$)  afterward isn't something I've seen before.   Is this some advanced efficient coding?     These two lines as they appear are a bit over my head.


3)
Code: (Select All)
_MemCopy m1, m1.OFFSET, m1.SIZE To m0, m0.OFFSET

This can be found in the wiki, and it says:
The _MEMCOPY statement copies a block of bytes from one memory offset to another offset in memory.

This purpose of this isn't clear to me.   Is it just a quicker copying method (as opposed to setting up loops to copy an array) or is there some other advantage?
Also I have no idea what the OFFSET is doing.    The wiki says it's about memory blocks so this seems like a more advanced coding/theory (beyond my level of experience)


4)  
Code: (Select All)
While _MouseInput: Wend


This is probably obvious to everyone here but I'm a bit lost.   The wiki shows the Wend statement on a completely different line, so if you have this all on one line, what is happening?
The code I'm referring to has a comment at the end (While _MouseInput: Wend ' clear)  so the intent is to clear....but how this works to clear is what I'm wondering.   


5)
Code: (Select All)
m2Dn = _MouseButton(2) ' button 2 processing
If m2Dn Then ' Btn 2 down

This is straightforward enough, but what's unclear to me is the IF statement:

If m2Dn then

I have never seen this before, where the IF THEN does not have an equation between them.    Example:

If m2Dn>1 then
if m2Dn=0 then

I'd definitely like to understand how this works.


Thanks!
Reply


Messages In This Thread
Various code questions - by james2464 - 08-17-2022, 01:57 PM
RE: Various code questions - by mnrvovrfc - 08-17-2022, 02:09 PM
RE: Various code questions - by SMcNeill - 08-17-2022, 02:09 PM
RE: Various code questions - by SMcNeill - 08-17-2022, 02:13 PM
RE: Various code questions - by SMcNeill - 08-17-2022, 02:21 PM
RE: Various code questions - by SMcNeill - 08-17-2022, 02:30 PM
RE: Various code questions - by OldMoses - 08-17-2022, 04:55 PM
RE: Various code questions - by james2464 - 08-17-2022, 06:30 PM
RE: Various code questions - by SMcNeill - 08-17-2022, 06:35 PM
RE: Various code questions - by james2464 - 08-17-2022, 06:43 PM
RE: Various code questions - by SMcNeill - 08-17-2022, 06:53 PM
RE: Various code questions - by Kernelpanic - 08-17-2022, 08:32 PM
RE: Various code questions - by SMcNeill - 08-17-2022, 09:25 PM
RE: Various code questions - by Kernelpanic - 08-18-2022, 01:31 PM



Users browsing this thread: 5 Guest(s)