Or, to be more specific:

• Take no input.
• Output Loading..., with a trailing space, but no trailing newline.
• Infinitely cycle through the chars |, /, - and \: every 0.25 seconds, overwrite the last one with the next in the sequence. You can overwrite just the last character, or delete and rewrite the whole line, as long Loading... remains unchanged.

# Rules

• The output text must look exactly as specified. Trailing newlines/spaces are acceptable.
• You should not wait 0.25 seconds before initially showing output - the first frame should be printed as soon as the program is run.
• Your program should be able to run indefinitely. For example, if you use a counter for frames, the counter should never cause an error by exceeding the maximum in your language.
• Although the waiting period between each "frame" should be 0.25 seconds, obviously this will never be exact - an error margin of 10% or so is allowed.
• You may submit a function, but it must print to stdout.
• You can submit an answer in a non-console (but still text-based) environment, as long as it is capable of producing the loading animation.
• This is , so the shortest solution (in bytes) wins. Standard code-golf loopholes apply.

# Example

Here is the C++ code I used to create the example (ungolfed):

#include <iostream>
#include <string>

using namespace std;

int main() {
string cycle = "|/-\\";
int i = 0;

while (true) {
// Print current character
cout << cycle[i];

// Sleep for 0.25 seconds

// Delete last character, then increase counter.
cout << "\b";
i = ++i % 4;
}
}


May the best golfer win!

• Can submissions wait 0.25 seconds before initially displaying output? Nov 27, 2016 at 20:42
• No, but thanks for mentioning that, I'll add it to the rules @ETHproductions Nov 27, 2016 at 20:43
• Is a trailing newline (after the animating symbol) acceptable? Nov 27, 2016 at 20:43
• Of course :) @Copper Nov 27, 2016 at 20:44
• @TheBitByte it means that, theoretically, nothing inside your program will cause it to error - such as a counter overflowing or reaching maximum recursion depth. Dec 15, 2016 at 6:57

# C, 9289 82 bytes

i;f(){for(;;i=4)while(i--)dprintf(2,"\rLoading... %c","|\\-/"[i]),usleep(250000);}


# T-SQL, 121 bytes

DECLARE @ CHAR W:SET @=IIF(@='/','-',IIF(@='-','\',IIF(@='\','|','/')))PRINT'Loading... '+@ WAITFOR DELAY'0:0:0.25'GOTO W


# Yabasic, 83 bytes

An anonymous function that takes no input and outputs to the console in graphics mode. Does not function with TIO.

Clear Screen
Do
?@(1,11)Mid$("|/-\\",i+1,1) Wait.25 i=Mod(i+1,4) Loop  • Can you use i instead of i+1 in Mid$? May 17, 2018 at 11:55
• @12Me21 Unfortunately not - Mid$ is 1-indexed in Yabasic, so the +1 is necessary. You can see this in the context of this question here May 17, 2018 at 12:43 ## Groovy, 60 bytes 59 bytes, 61 bytes print'Loading...';for(;;)'|/-\\'.any{print"$it\b";sleep 250}


(modified to work with later versions of groovy, removed ascii cast)

# Stax, 24 bytes

Ñ!Δ╚«&╖ô^ô◙⌠≈%<╗∞█z9ÖºOT


Run and debug it

Delays 15 frames between each change, which at default 60fps should be equal to 1/4th of a second.

## Explanation

WlAtv>!"|/-\"{[+p{|,}15*|:F
W                             loop forever
lAtv>!                     push "Loading... "
"|/-\"{            F for each char in "|/-\"
{|,}15*    delay 1 frame 15 times
|:  clear the screen

• limiting your display to 30fps would mess with any of the programs here. Jun 10, 2021 at 2:57
• Hm. An error margin is allowed, and no fps requirements are specified. It should work fine on any modern browser. Jun 10, 2021 at 3:00
• I will specify a 60fps browser requirement then. Jun 10, 2021 at 3:03
• Jun 10, 2021 at 3:05

# 05AB1E, 26 bytes

[13ç”²½... ”"|/-\"NèJ?Ƶ–.W


[13ç”...”"..."NèJ?Ƶ–.W  # trimmed program
[                       # forever...
ç                    # push character with codepoint...
13                     # literal
è        # push character in...
"..."          # literal...
è        # at index...
N         # current index in loop...
è        # modulo length of...
"..."          # literal
?      # output...
J       # joined stack...
?      # without trailing newline
.W  # wait...
Ƶ–    # 250...
.W  # milliseconds


# Python 3, 93 bytes

import time