Sinisterly
Must be the Ganja - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: Must be the Ganja (/Thread-Must-be-the-Ganja)

Pages: 1 2


RE: Must be the Ganja - TOP. - 04-16-2012

(04-15-2012, 08:13 PM)Dapaus Wrote: @PhazeShift: at the end of the code there is "pause && goto :eof"
But where exactly is :eof going to?

That's exactly what I was wondering but I decided not to ask it.


RE: Must be the Ganja - ArkPhaze - 04-16-2012

(04-15-2012, 08:13 PM)Dapaus Wrote: @PhazeShift: at the end of the code there is "pause && goto :eof"
But where exactly is :eof going to?

It's a default standard for batch scripters to use, habit for me when I pipe arguments to calling blocks in batch, as I may want to call it but never actually go to the code, and exit when i'm done with the main bit before unnecessarily going to those calls.


RE: Must be the Ganja - DaPaus - 04-16-2012

(04-16-2012, 05:11 AM)PhazeShift Wrote: It's a default standard for batch scripters to use, habit for me when I pipe arguments to calling blocks in batch, as I may want to call it but never actually go to the code, and exit when i'm done with the main bit before unnecessarily going to those calls.

So it actually go to a code block that doesn't exist and quits?


RE: Must be the Ganja - ArkPhaze - 04-17-2012

(04-16-2012, 06:36 PM)Dapaus Wrote:
(04-16-2012, 05:11 AM)PhazeShift Wrote: It's a default standard for batch scripters to use, habit for me when I pipe arguments to calling blocks in batch, as I may want to call it but never actually go to the code, and exit when i'm done with the main bit before unnecessarily going to those calls.

So it actually go to a code block that doesn't exist and quits?

:nono: No... It's a command which became available in Windows versions of NT 4 and above which indicates the end of a function or subroutine and returns the calling code to the label of that function.

Example:
Code:
@echo off call :setvar 10 echo Stored Variable... goto test :setvar set /a num=(%1) + 1 goto :eof :test echo This is your new var... %num% pause



RE: Must be the Ganja - DaPaus - 04-17-2012

(04-17-2012, 01:01 AM)PhazeShift Wrote: :nono: No... It's a command which became available in Windows versions of NT 4 and above which indicates the end of a function or subroutine and returns the calling code to the label of that function.

Example:
Code:
@echo off call :setvar 10 echo Stored Variable... goto test :setvar set /a num=(%1) + 1 goto :eof :test echo This is your new var... %num% pause

Okay thanks, I understand it now Biggrin


RE: Must be the Ganja - TOP. - 04-17-2012

(04-17-2012, 03:52 PM)Dapaus Wrote:
(04-17-2012, 01:01 AM)PhazeShift Wrote: :nono: No... It's a command which became available in Windows versions of NT 4 and above which indicates the end of a function or subroutine and returns the calling code to the label of that function.

Example:
Code:
@echo off call :setvar 10 echo Stored Variable... goto test :setvar set /a num=(%1) + 1 goto :eof :test echo This is your new var... %num% pause

Okay thanks, I understand it now Biggrin

As well as I do I never knew that Smile


RE: Must be the Ganja - ArkPhaze - 04-18-2012

"Functions" in batch are very useful if you know how to send the arguments to a label with CALL