Loading... Forever

106

16

Your challenge is to make an infinite loading screen, that looks like this:

enter image description here


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.
  • If possible, please provide a gif of your loading screen in action.

Example

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

#include <iostream>
#include <string>
#include <thread>

using namespace std;

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

    cout << "Loading... ";

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

        // Sleep for 0.25 seconds
        this_thread::sleep_for(chrono::milliseconds(250));

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

May the best golfer win!

FlipTack

Posted 2016-11-27T20:28:55.133

Reputation: 13 242

3Can submissions wait 0.25 seconds before initially displaying output? – ETHproductions – 2016-11-27T20:42:02.277

2No, but thanks for mentioning that, I'll add it to the rules @ETHproductions – FlipTack – 2016-11-27T20:43:09.787

Is a trailing newline (after the animating symbol) acceptable? – Copper – 2016-11-27T20:43:58.183

Of course :) @Copper – FlipTack – 2016-11-27T20:44:52.513

@FlpTkc what if you have the slowest language ever? – Destructible Lemon – 2016-11-27T22:08:19.500

@DestructibleWatermelon as long as somewhere in your code there is something like sleep( 1/4 ), i.e. your algorithm is correct, the amount of time that the other operations take isn't overly relevant, as long as the animation will actually run. Or, get a faster language :P – FlipTack – 2016-11-27T22:10:20.897

I was just thinking really hard, why your example program prints \ two times in a row. :) – raznagul – 2016-11-28T13:56:10.030

@raznagul you need the double backslash, otherwise C++ thinks I'm trying to use a control character :P – FlipTack – 2016-11-28T15:11:01.627

I didn't know characters could be deleted from the console once printed. Is \b cross-platform\language? I tried printing (print "Hello\bWorld") in a Clojure REPL, and it printed a garbage character for the backspace. – Carcigenicate – 2016-11-29T00:19:47.577

Nvm. It has to be running in a windows console, not a REPL, to work. – Carcigenicate – 2016-11-29T00:32:34.747

For non-stdout implementations, does the font have to be monospace? – Ben Aubin – 2016-11-29T03:27:32.973

@penne12 No, you can use the default font – FlipTack – 2016-11-29T06:50:36.630

May I substitute for -? – Adám – 2016-11-29T08:49:14.607

@Adám yes, that's acceptable - sorry for the late reply. – FlipTack – 2016-11-30T17:42:27.713

Can we start at any position in the animation? – Titus – 2016-12-08T15:40:43.283

Yes, as long as you cycle through the right characters @Titus – FlipTack – 2016-12-08T16:13:39.777

Does "run forever" mean the CS sense (where the halting problem comes into play), or just run forever normally? – Buffer Over Read – 2016-12-15T03:35:28.647

1@TheBitByte it means that, theoretically, nothing inside your program will cause it to error - such as a counter overflowing or reaching maximum recursion depth. – FlipTack – 2016-12-15T06:57:23.383

Could you add a scoreboard/leader board snippet? – ckjbgames – 2017-02-01T17:52:39.727

Answers

76

HTML/CSS, 183 180 163 161 160 147 143 bytes

a{display:inline-flex;overflow:hidden;width:1ch}c{animation:c 1s steps(4)infinite}@keyframes c{to{margin:0-4ch
<pre>Loading... <a><c>|/-\</pre>

Edit: Saved 3 bytes thanks to @betseg. Saved 17 bytes thanks to @manatwork. Saved 1 byte thanks to @Daniel. Saved 13 bytes thanks to @Ismael Miguel. Saved 4 bytes thanks to @Fez Vrasta.

Neil

Posted 2016-11-27T20:28:55.133

Reputation: 95 035

4According to meta, CSS+HTML is fine for answering questions. Furthermore I allowed this in the challenge description. So this answer is perfectly valid :) – FlipTack – 2016-11-27T21:30:38.570

5HTML+CSS is TC, so I don't see why it might be non-competing – TuxCrafting – 2016-11-27T21:34:39.037

1@TùxCräftîñg CSS is definitely not turing complete as you can solve the halting problem in it (If there is no infinite animation, it halts). I think the same applies for HTML (If you don't include JS). – Artyer – 2016-11-27T21:36:31.663

4

@Artyer http://stackoverflow.com/a/5239256/3273184 is something worth considering.

– Mama Fun Roll – 2016-11-27T21:42:10.713

4@MamaFunRoll A comment on that post mentions that that doesn't really prove it TC because it can't loop without user intervention. However, it can solve this particular challenge, so I don't see any problem with this answer. – ETHproductions – 2016-11-28T01:56:28.343

1@Neil you can remove last two braces and last semicolon in c to save three bytes. – betseg – 2016-11-28T05:53:24.000

@betseg Bah, how did I overlook that semicolon? Thanks! – Neil – 2016-11-28T09:35:25.813

Has the c tag default margin in any browser? If not, margin:0 instead of setting only margin-left will make no difference. – manatwork – 2016-11-28T09:38:20.843

@manatwork I didn't realise that I could animate margin-left that way, thanks! – Neil – 2016-11-28T09:42:02.413

@Neil, now that you formulated it that way… The entire 0% frame definition seems unnecessary in Firefox and Chrome. – manatwork – 2016-11-28T09:47:07.607

Holy cow, this almost has more upvotes than the question itself! – FlipTack – 2016-11-28T16:33:16.447

You can replace display:inline-block with display:inline-flex and save a byte :) – Daniel – 2016-11-28T18:54:50.120

I improved upon this answer a while ago with 132 bytes: http://codegolf.stackexchange.com/a/101315/47097

– darrylyeo – 2016-11-30T02:50:42.130

It seems that Google Chrome is happy without vertical-align: top;. Probably isn't required since you're using display: inline-flex;, which automatically aligns on top. You can try it here: https://jsfiddle.net/vw2e7y0w/

– Ismael Miguel – 2016-12-04T05:42:55.437

@IsmaelMiguel Huh, must be a Firefox bug I guess... – Neil – 2016-12-04T10:41:35.430

@Neil As long as you can replicate it in one environment, it is a valid answer. An example would be this: http://codegolf.stackexchange.com/a/61126/14732 (only works on a very specific version of a specific environment)

– Ismael Miguel – 2016-12-04T10:45:21.577

@IsmaelMiguel Sure, but I only use Firefox, and I don't really want to log in to Stack Overflow in another browser just for this one question. – Neil – 2016-12-04T11:03:34.900

@Neil You could try the jsfiddle. I've quickly tested and using <code> instead of <pre> works on Firefox, but breaks the animation on Google Chrome. – Ismael Miguel – 2016-12-05T10:24:56.230

@IsmaelMiguel Adding </pre> fixes it for me on Firefox, it must be parsing the DOM differently I guess... – Neil – 2016-12-05T11:29:59.657

@Neil Probably is. But don't forget to mention that it only works on Google Chrome. Mentioning the 2 possible fixes may could help too. But I'm not sure about that. – Ismael Miguel – 2016-12-05T11:32:36.123

@IsmaelMiguel Ah, it's an SO bug - they send extra content to Firefox which breaks the snippet. Sigh... – Neil – 2016-12-05T11:38:24.900

It's a huge shame that you have to use </pre>. Maybe there's a tag closing (like <p>) that can fix the issue? – Ismael Miguel – 2016-12-05T19:36:04.617

@IsmaelMiguel Seems to just make things worse, sorry. – Neil – 2016-12-06T00:19:43.967

It does. The only that fixed it was <table> but that is 1 byte longer. – Ismael Miguel – 2016-12-06T08:49:31.173

You can also use margin:0 -4ch to save 4 LOC – Fez Vrasta – 2017-01-09T14:39:30.620

Ohh. So that's partially how you make custom tags. – Matthew Roh – 2017-04-07T09:18:33.750

57

Vim, 43, 41 bytes

qqSLoading... |<esc>:sl250m
r/@:r-@:r\@:@qq@q

Two bytes saved thanks to @Udioica!

Here's a (slightly outdated) animation of it happening in real time!

enter image description here

And here is an explanation:

qq                              " Start recording into register 'q'
  SLoading... |<esc>            " Replace all of the text in the buffer with 'Loading... |'
                    :sl250m     " Sleep for 250 ms
r/                              " Replace the bar with a slash
  @:                            " Re-run the last ex command (sleeping)
    r-                          " Replace the slash with a dash
      @:                        " Re-run the last ex command (sleeping)
        r\                      " Replace the dash with a backslash
          @:                    " Re-run the last ex command (sleeping)
            @q                  " Run macro 'q' (the one we're recording)
              q                 " Stop recording
               @q               " Call macro 'q', which will run forever because it's recursive

James

Posted 2016-11-27T20:28:55.133

Reputation: 54 537

1just curios: does it violate "Your program should be able to run indefinitely"? can it eventually reach a stack overflow? :) – Dan Oak – 2016-11-28T17:11:08.030

4@dahnoak Well, obviously I can't infinitely test it, but it doesn't allocate any extra memory, so I can't see any reason it wouldn't work indefinitely. – James – 2016-11-28T17:14:47.180

1If you switch i to S and move it inside the macro, you can skip r|. – udioica – 2016-11-28T20:46:24.880

2@dahnoak There is no reason why the vi engine couldn't notice the tail recursion. And some implementations of recursion would do so naturally (imagine if there is a vector of commands to-be-executed, and a current execution location. Then @q would insert at-current-location the contents of register script q. No stack needed, and no memory allocated unless there are commands to run after @q within q.) – Yakk – 2016-11-29T14:59:56.993

Almost every time you post an answer to a challenge, I learn something new (in this case, @: and :sl), so thanks and keep them coming :) – Christian Rondeau – 2016-12-04T17:39:33.170

@ChristianRondeau I'm glad you like it, but IMO this is the more impressive answer . :D

– James – 2016-12-04T17:43:38.503

37

HTML + JS (ES6), 20 + 51 50 = 70 bytes

setInterval(_=>a.innerHTML='|/-\\'[i=-~i%4],i=250)
Loading... <a id=a>-

-1 byte (Zachary T)

Check out my 132 byte HTML/CSS answer as well.

darrylyeo

Posted 2016-11-27T20:28:55.133

Reputation: 6 214

Might that overflow i? – Zacharý – 2016-11-27T22:50:12.487

Yes, it eventually would. Fixed that! – darrylyeo – 2016-11-27T22:56:08.893

Am I mistaken, or do you not need the ,i? – Zacharý – 2016-11-27T23:01:28.620

It's necessary. i++%=4 doesn't work because both ++ and %= perform assignments, and you can only have one assignment operator at a time. – darrylyeo – 2016-11-27T23:12:36.100

1Could you replace i++,i%=4 with i=-~i%4 for a byte? – Zacharý – 2016-11-27T23:17:07.350

Most definitely. – darrylyeo – 2016-11-27T23:42:48.907

You can use a string as the argument to setInterval – jrich – 2016-11-28T03:51:01.743

Shouldn’t the HTML contain a <pre>? The other HTML answer did include it. – user42589 – 2016-11-29T06:29:50.230

@jrich Good tip, but wrapping it in another string doesn't play well with the escaped backslash: setInterval("a.innerHTML\n='|/-\\\\'[i=-~i%4]",i=250). – darrylyeo – 2016-11-30T02:42:19.040

2@Xufox The <pre> only ensured a monospaced font was used so that ch units would work. The rules don't mention anything about the font family used. ;) – darrylyeo – 2016-11-30T02:46:47.417

1If I am not mistaken, the first character printed by JS will be the last one in the string; so you should init with - instead of /. Or init with | and loop through '-\\|/'. Nice increment though. – Titus – 2016-12-08T15:46:36.967

@Titus Good catch, updated! – darrylyeo – 2016-12-10T00:17:43.110

21

Windows Batch, 121 114 84 80 79 78 bytes

Just throwing this out for fun.

for %%b in (/ - \ ^|)do (cls
@echo Loading... %%b
ping 1.1 -n 1 -w 250>nul)
%0

I was not able to assign pipe (|) into the array, so I had to manually add it with another assignment. The delay is done with PING, which might not be accurate.

Output:

enter image description here

Edit:

  • Thanks to Roman Gräf for saving 7 bytes!
  • Thanks to Neil for saving 30 bytes! I have also mangled it a bit more to save bytes on the newlines.
  • Thanks to phyrfox for saving 4 bytes!
  • Thanks to YourDeathIsComing for saving 2 bytes!

user6616962

Posted 2016-11-27T20:28:55.133

Reputation: 311

3You can remove @echo off and put an @ in front of every set or echo command – Roman Gräf – 2016-11-28T09:56:27.640

1You don't need the array, in (/ - \ ^|) works. Also, %0 is a shorter way to loop than goto. – Neil – 2016-11-28T17:32:04.620

Thanks @Neil! The array notation really helped. Also, I was unsure with how I used %0 here. Is it correct? – user6616962 – 2016-11-29T01:54:47.983

Yes, that looks right. – Neil – 2016-11-29T08:55:16.457

2You should be able to use the IP address "1.1" (-4 bytes), because most platforms will auto-expand that to 1.0.0.1 for you. – phyrfox – 2016-11-29T16:49:05.677

1You can save 1 byte by removing the space in front of >nul. – YourDeathIsComing – 2016-11-30T20:30:12.583

@YourDeathIsComing d'oh! I tried it before, but had thought that only 250 would be directed to null. Thanks! – user6616962 – 2016-12-01T01:36:03.170

You should also be able to remove the space in front of do. – YourDeathIsComing – 2016-12-04T15:30:53.277

@YourDeathIsComing cmd seems to complain about it. http://imgur.com/a/wEkFw

– user6616962 – 2016-12-05T02:05:25.533

1I meant the space before it, not after it. – YourDeathIsComing – 2016-12-05T05:31:32.830

It seems that ping a -n 1 -w 250>nul also works. This tries to ping the host //a, which doesnt exist. I tried it with a 2500ms delay instead, and the delay happened. I've tested on Windows 7. With this, you can save 2 bytes. – Ismael Miguel – 2016-12-05T10:49:41.053

@IsmaelMiguel it seems to be a lot slower than 250ms. Here's a webm of ping 1.1, ping a and the accepted answer. https://webmshare.com/omWXQ

– user6616962 – 2016-12-06T02:09:08.703

Using ping . -n 1 -w>nul seems to give a delay of around 200-300ms. But that's visually, and I don't know how to time it on the CMD. But you were right, my version is slower than 250ms. It seems to be around 3-4s – Ismael Miguel – 2016-12-07T10:36:30.353

20

Node, 72 70 bytes

f=i=>console.log('\x1BcLoading... '+'|/-\\'[setTimeout(f,250,i=-~i%4),i])

Replace \x1B with the literal escape character to get the correct byte count. Call f() to start the animation. Here's how it looks in the ConEmu terminal emulator on my computer:

enter image description here

ETHproductions

Posted 2016-11-27T20:28:55.133

Reputation: 47 880

Try using \033c (replace \033 with its actual char representation). It doesn't look as good, but it saves you some bytes. – Mama Fun Roll – 2016-11-27T21:43:56.797

Won't i overflow? – Zacharý – 2016-11-27T23:22:47.693

12@ZacharyT It will after 71 million years, but I can fix that if necessary – ETHproductions – 2016-11-27T23:54:55.240

3"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.", yes, it's necessary. – Zacharý – 2016-11-28T00:40:21.000

@ZacharyT OK, fixed. – ETHproductions – 2016-11-28T02:46:02.170

@MamaFunRoll Thanks, that saves two bytes! – ETHproductions – 2016-11-28T02:46:13.207

When running your code on d8 (instead of node), you could use print instead of console.log and save 6 bytes. – Florent – 2016-11-30T08:11:41.440

3@Florent But then it wouldn't run on Node ;-) – ETHproductions – 2016-12-01T19:35:37.700

14

Kotlin, 67 66 bytes

while(1>0)"|/-\\".map{print("\rLoading... $it");Thread.sleep(250)}

enter image description here

Fairly self explanatory, using \r to clear the line and taking advantage of Kotlin's awesome string interpolation.

EDIT: Saved 1 byte thanks to @mEQ5aNLrK3lqs3kfSa5HbvsTWe0nIu by changing while(true) to while(1>0)

Tyler MacDonell

Posted 2016-11-27T20:28:55.133

Reputation: 701

1You could save one byte by using while(1>0) instead of while(true) (-1) & probably should include the actual function syntax in your answer (fun a(){<code>}, +9). If you wanna be a bit cheaty, you could use store a function as a variable (val a={<code>}, +8). – F. George – 2016-11-28T06:13:26.993

2@mEQ5aNLrK3lqs3kfSa5HbvsTWe0nIu Is 'full program' mode not acceptable? This can be run as a Kotlin script .kts without class or function definitions.

Also, great call with while(1>0)! – Tyler MacDonell – 2016-11-28T14:06:33.457

3But what if, one day, 0 becomes greater than 1???? :P – FlipTack – 2016-11-28T15:14:00.367

Great idea of using Kotlin script.

@Flp.Tkc Your comment reminded me of this: http://codegolf.stackexchange.com/a/101131/62024. Still shuddering that this is possible.

– F. George – 2016-11-28T20:00:53.583

@TylerMacDonell Really? I didn't know you could run kotlin directly as a script. Thanks for the info. – TheNumberOne – 2017-01-06T02:28:38.033

Not familiar with this, but wouldnt while(1) be shorter? Or doesnt this work? – Gerrit Luimstra – 2017-01-12T12:56:45.080

@Gerrit Luimstra Doesn't work in Kotlin, must be a Boolean. :( – Tyler MacDonell – 2017-01-14T02:58:52.653

14

Vim, 35 bytes

iLoading... \-/|<Esc>qqdb:sl250m<CR>p@qq@q

The boring version. Here's a non-complying solution that's better:

Vim (1 second sleep), 27 bytes

idbgsp@@<C-U>Loading... \-/|<Esc>@.

Using gs not only is much shorter, but you don't have to hit Enter. That means the macro fits in-line, and I can save bytes by switching to @.. (Since nothing after the recursive call can ever run, I can type whatever I want.)

udioica

Posted 2016-11-27T20:28:55.133

Reputation: 2 381

Thanks for this answer! I learned gs, @. and the @@ within @. still makes my head hurt! – Christian Rondeau – 2016-12-14T04:39:34.100

14

Pyth, 31 bytes

Wm,p+"\rLoading... "d.d.25"|/-\

Interpreter here.

Loading GIF

Explanation

Wm,p+"\rLoading... "d.d.25"|/-\
    +"\rLoading... "d              Concatenate the string "\rLoading... " and the variable d
   p                               Print the result without a newline
                     .d.25         Sleep for 0.25 seconds
  ,                                Form a two-element list with the results of the two statements above. This is only needed to execute both statements in a single lambda function.
 m                        "|/-\    Map the above statement over the characters in the string "|/-\", setting the variable d to the character for each iteration
W                                  While the result of the map statement is true, do nothing

insert_name_here

Posted 2016-11-27T20:28:55.133

Reputation: 816

13

Powershell (v4), 57 56 54 53 58 57 Bytes

Back at the Bytecount I started with!

for(){cls;"Loading... "+"|/-\"[($a=++$a%4)];sleep -m 250}

The CLI in powershell will glitch out slightly on some computers, so it doesn't look perfect, but it's as good as I can feasibly get.

Moved $a++ into the for loop to save one byte, (no ;)

Then moved it into the array indexer, for another 2 byte save, thanks to Roman for pointing that out.

Also saved 1 more byte (;) by moving the Clear screen (cls) part into the for loop..

Issue and fix pointed out by TimmyD for the infinite aspect of the question, only +5 Bytes required, changed $a++%4 into ($a=++$a%4) so it will never go above 3.

Saved another byte by leaving the for loop totally blank, thanks to 'whatever' for pointing out that this is actually possible in Powershell Version 4!

New updated gif for the (final?) version of this answer.

Loading Gif

for(;;cls){"Loading... "+"|/-\"[($a=++$a%4)];sleep -m 250}

for(;;cls){"Loading... "+"|/-\"[$a++%4];sleep -m 250}

for(;;){"Loading... "+"|/-\"[$a++%4];sleep -m 250;cls}

for(;;$a++){"Loading... "+"|/-\"[$a%4];sleep -m 250;cls}

for(;;){$a++;"Loading... "+"|/-\"[$a%4];sleep -m 250;cls}

colsw

Posted 2016-11-27T20:28:55.133

Reputation: 3 195

2for(;;){"Loading... "+"|/-\"[$a++%4];sleep -m 250;cls} (move the $a++ to the last usage of $a) – Roman Gräf – 2016-11-28T14:28:55.547

always forgetting something - thanks for that! – colsw – 2016-11-28T14:34:50.917

2I'm not very adept at Powershell, but when I saw the Windows Batch entry, i thought "Could Powershell beat this?". And here it is! – Jakub Jankowski – 2016-11-29T20:49:22.523

@TimmyD this requires the () wrap to do, so it's actually a 5 byte loss, but neccessary all the same. thanks for pointing that out. – colsw – 2016-11-30T11:26:13.907

@JakubJankowski Powershell is a pretty powerful shell, there's some stuff cmd natually does very well, but i'd expect powershell to be a better golfing language overall for non-fringe challenges. – colsw – 2016-11-30T11:37:25.440

1At least on ps v4 you should be able golf another byte by keeping the for condition totally empty: for(){cls;"Loading... "+"|/-\"[($a=++$a%4)];sleep -m 250} – whatever – 2016-12-02T13:34:51.927

@whatever updated - totally didn't realize that was possible in v4 - thanks! – colsw – 2016-12-02T13:51:15.110

1You're welcome. It actually seems to work for Version 2+, was just too lazy to check before ;) – whatever – 2016-12-02T13:54:52.167

definitely need to remember that one for the future. – colsw – 2016-12-02T14:58:44.753

11

Matlab, 78 75 bytes

a='\|/-';while 1;clc;disp(['Loading... ',a(1)]);a=a([2:4,1]);pause(1/4);end

enter image description here

flawr

Posted 2016-11-27T20:28:55.133

Reputation: 40 560

11

Pyth - 36 35 bytes

#+"\033cLoading... "@"\|/-"~hZ.d.25

Doesn't work online, obviously.

Maltysen

Posted 2016-11-27T20:28:55.133

Reputation: 25 023

Do you have a gif of this in action? Also, is there any counter that could overflow? – FlipTack – 2016-11-28T18:01:25.577

@Flp.Tkc the only counter is Z which is a python integer, which don't overflow. I was trying to make a gif but couldn't get it to work. If you know how to make one, you can run it with the pyth interpreter at https://github.com/isaacg1/pyth

– Maltysen – 2016-11-29T02:57:06.513

4If the integer doesn't overflow, then it'll probably grow until filling up all memory, which would make it fail at least after 10⁶⁵⁰⁰⁰⁰⁰⁰⁰ years on most 32-bit systems. Sure, the heat death of the universe will happen first, but still... – jjrv – 2016-12-01T10:47:38.700

11

HTML/CSS, 23 + 109 = 132 bytes

Improved upon Neil's answer.

pre{display:flex}a{overflow:hidden;animation:a 1s steps(4)infinite;width:1ch}@keyframes a{to{text-indent:-4ch
<pre>Loading... <a>|/-\

darrylyeo

Posted 2016-11-27T20:28:55.133

Reputation: 6 214

9

Python 2, 81 79 78 77 bytes

import time
i=1
while 1:print'\rLoading...','\|/-'[i%4],;i+=1;time.sleep(.25)

Quite a simple solution that sleeps using time.

I use \r (A carriage return) to go back to the start of the line and then print the message overwriting the line.

I start with i=1 to avoid double escaping the \ (It is '\|/-' instead of '|/-\\').

In the past, I had used -~i to mean i + 1 to avoid parentheses. (Thanks to @Flp.Tkc for these -2 bytes!) (It was i=(i+1)%4 vs. i=-~i%4)

Now, I am just letting the counter rise forever, as technically Python ints can't overflow. Thanks to @Zachary T for pointing that out and saving a byte!
It only stops on a machine because the machine runs out of memory, but this takes 9.7 generations with 4GB of memory for that one int.

Thanks to @Kade for the -1 byte where print a,b prints a and b space seperated, so I don't need my own space.

Here's a gif of it working on Windows:

Loading

I tested it on a Linux VM too. I couldn't test it on a Mac.

Artyer

Posted 2016-11-27T20:28:55.133

Reputation: 1 697

1If I remember correctly, you can use i=-~i%4 to save the bytes for the parens :) – FlipTack – 2016-11-27T21:48:17.790

I think that should overwrite using the carriage return. – Zacharý – 2016-11-27T21:51:00.817

1And you forgot the i in -~i. – Zacharý – 2016-11-27T21:52:22.123

2Won't replacing [i],;i=-~i%4 with [i%4],;i+=1 save a byte since it doesn't exceed the max for Python, only the maximum memory? – Zacharý – 2016-11-27T22:03:36.170

@ZacharyT That seems against the spirit of the challenge. – Artyer – 2016-11-27T22:05:00.117

9I should downvote you for logging in as Administrator... – Neil – 2016-11-27T22:06:28.110

5@Neil To be totally honest, I just put the Python file in Administrator and ran it from there because the other account names are real names (Personal PC). – Artyer – 2016-11-27T22:07:32.517

2I'd allow @ZacharyT 's suggestion as technically Python integers can be infinitely large, as long as the computer has memory to hold them – FlipTack – 2016-11-27T22:11:47.027

1I think you can save some bytes by using the time as your index instead of a counter (while 1:print'\rLoading... '+'\|/-'[int(time.time()*4)%4],) and not sleeping – artificialnull – 2016-11-28T00:41:34.543

@artificialnull, that would assume that each step in the while loop takes a certain amount of time. AKA, that won't work on all systems. – Zacharý – 2016-11-28T00:52:55.380

@ZacharyT I don't think so. If you run the code I proposed, it constantly updates the line and only changes when the time is a multiple of 0.25 (achieved by multiplying by 4 and then mod 4-ing). Please correct me if I'm mistaken. – artificialnull – 2016-11-28T00:57:36.397

What allows you to assume that the time is a multiple of 0.25? – Zacharý – 2016-11-28T00:59:22.117

@ZacharyT multiplying the floating point time provided by time.time() by 4 and converting to an integer gets the current time counted in quarter second increments. – artificialnull – 2016-11-28T01:34:24.453

I know that! What lets you assume every iteration of the while loop will take a fixed duration of time? – Zacharý – 2016-11-28T01:50:53.033

1@ZacharyT +/-10% is allowed – Tim – 2016-11-28T08:25:05.257

What lets you even assume that it will be within 10%? – Zacharý – 2016-11-28T13:23:54.133

Also, the challenge says to print it in the correct order and you can't sleep at the beginning, so the time.time solution would most likely break that. – Artyer – 2016-11-28T16:37:40.470

1print'\rLoading... '+ -> print'\rLoading...', should save a byte. – Kade – 2016-12-08T18:05:19.353

9

Mathematica, 74 67 Bytes

ListAnimate["Loading... "<>#&/@{"|","/","-","\\"},AnimationRate->4]

A whopping 7 bytes off thanks to @dahnoak

A Simmons

Posted 2016-11-27T20:28:55.133

Reputation: 4 005

ListAnimate["Loading... "<>#&/@Characters@"|/-\\",AnimationRate->4] – Dan Oak – 2016-11-28T17:25:18.023

1@dahnoak cheers! I didn't realise ListAnimate was a thing. It's a shame that <> is Flat not Listable otherwise 4 more bytes could be shaved off! – A Simmons – 2016-11-28T17:30:14.680

Just for fun: Dynamic["Loading... "<>{"|","/","-","\\"}[[1+Round[4Now@"Second"]~Mod~4]],UpdateInterval->.25] – shrx – 2016-12-15T14:58:05.553

9

C#, 170 133 Bytes

void X(){Console.Write("Loading...  ");for(;;){foreach(var c in "|/-\\"){Console.Write("\b"+c);System.Threading.Thread.Sleep(250);}}}

Big thanks to Roman Gräf and raznagul, who saved me 37 bytes. (Especially raznagul, who pointed out, that my original solution was invalid anyway. I kinda missed out on something there, but it's fixed now and should meet the requirements :)

pretty similar to Pete Arden's existing C# answer but with some improvements

e.g. "for(;;)" instead of "while (true)", char instead of string

I would have commented my suggestions on his answer but I don't actually have enough reputation to do that.

Ungolfed:

static void X()
{
    Console.Write("Loading...  ");
    for (;;)
    {
        foreach (var c in "|/-\\")
        {
            Console.Write("\b" + c);
            System.Threading.Thread.Sleep(250);
        }
    }
}

Snowfire

Posted 2016-11-27T20:28:55.133

Reputation: 181

2Why don't remove the first Console.Write("\b"); and change the second to Console.Write("\b"+a);? – Roman Gräf – 2016-11-28T15:14:42.257

Defining an action is unnecessary and to long using a loop like foreach(var a in"|/-\\") and add the code you currently have in the action as the body will save you ~20 Bytes. – raznagul – 2016-11-28T15:34:49.890

Also, the task is to create the required output exactly. Which is currently not the case. – raznagul – 2016-11-28T16:00:56.640

It should be the case now, I forgot '|' and the trailing space after "Loading...". – Snowfire – 2016-11-28T16:21:15.283

In your ungolfed version (since it doesn't match the golfed version), you can remove the first Console.Write() and use just one Console.Write($"Loading... {c}\r") instead of the second. – milk – 2016-11-28T18:38:01.627

Your Console.Writes should be System.... you might be able to use using c = System.Console; to save bytes though I haven't tested it. You can compile to a Action and save more bytes – TheLethalCoder – 2016-11-30T15:27:25.640

9

Forth, 72, 73 bytes

EDIT:

  • Added the Gforth-only version, 69 bytes (Thanks @ninjalj !)
  • Added missing whitespace after "Loading..." (Thx @Roman Gräf !), +1 byte
  • Updated to match the rules more precisely (in the same byte count)

Golfed

: L '| '/ '- '\ begin .\" \rLoading... " 3 roll dup emit 250 ms again ; L

Gforth version

The GNU Forth-only version can be brought down to 69 bytes like this:

'| '/ '- '\ [begin] .\" \rLoading... " 3 roll dup emit 250 ms [again]

Screencast

enter image description here

Try it online !

zeppelin

Posted 2016-11-27T20:28:55.133

Reputation: 7 884

1Since you are using gforth, if you don't care about portability to other Forth's, you can use [begin] and [again] outside a word definition. – ninjalj – 2016-11-30T21:48:59.817

7

MATL, 36 bytes

1 byte removed using @flawr's idea of circularly shifting the string

'\-/|'`Xx1YS'Loading... 'y1)hD.25Y.T

Here is a gif recording from the offline compiler:

enter image description here

Or try it at MATL Online! If it doesn't initially run, refresh the page and press "Run" again.

How it works

'\-/|'           % Push this string
`                % Do...while
  Xx             %   Clear screen
  1YS            %   Circularly shift thr string 1 step to the right
  'Loading... '  %   Push this string
  y              %   Duplicate the string of shifting symbols
  1)             %   Get the first character
  hD             %   Concatenate the two strings and display
  .25Y.          %   Pause for 0.25 seconds
  T              %   Push "true". This is used as loop condition, to it
                 %   generates an infinite loop
                 % End loop implicitly

Luis Mendo

Posted 2016-11-27T20:28:55.133

Reputation: 87 464

Hey Luis. well done with MATL as always. Here's a slight variation of the circular list. and display. Do you think you could translate that in an even shorter solution: a='\|/-';k=1; fprintf('Loading... -') while 1 k=mod(k,4)+1; fprintf('\b\b%c\n',a(k)); pause(.25); end – Hoki – 2016-12-04T10:51:12.393

@Hoki Thanks for the idea. Actually I initially had an increasing counter modulo 4, but it was a little longer (I then gained a byte because of the requirement of no initial pause). Also, I think clear screen and normal display is shorter than fprintf with backspaces

– Luis Mendo – 2016-12-04T15:45:57.433

7

Dyalog APL, 50 bytes

This only works in the Windows version, as otherwise the ⎕SM window will not show unless ⎕SR is called.

{⎕SM←1 1,⍨⊂⊃⍵⌽'Loading... '∘,¨'|/-\'⋄∇4|⍵+⌈⎕DL÷4}1

Explanation:

  • {...}1: run the function beginning with ⍵=1
  • Loading... '∘,¨'|/-\': generate the four possible outputs
  • ⊂⊃⍵⌽: Rotate the list to put the ⍵th element first, take the first element, and enclose it
  • ⎕SM←1 1,⍨: put the string in the top-left corner of the ⎕SM window.
  • ⎕DL÷4: wait 1/4th of a second
  • 4|⍵+⌈: round up the resulting value (seconds spent waiting, so this is always 1), add it to (incrementing it), and take the mod-4 (to prevent it from eventually overflowing).
  • : run the function again with the new .

Animation

marinus

Posted 2016-11-27T20:28:55.133

Reputation: 30 224

Somehow I knew someone would submit an answer for this challenge for Dyalog (/APL) :) – YoYoYonnY – 2016-11-30T18:21:12.983

7

C#, 187 Bytes

Golfed:

void L(){Console.Write("Loading...");Action<string>l=(a)=>{Console.SetCursorPosition(11,0);System.Threading.Thread.Sleep(250);Console.Write(a);};while(true){l("|");l("/");l("-");l("\\");}

Ungolfed:

public void L()
{
  Console.Write("Loading...");
  Action<string> l = (a) =>
  {
    Console.SetCursorPosition(11, 0);
    System.Threading.Thread.Sleep(250);
    Console.Write(a);
  };
  while (true)
  {
    l("|");
    l("/");
    l("-");
    l("\\");
  }
}

Still waiting for it to load...

enter image description here

Pete Arden

Posted 2016-11-27T20:28:55.133

Reputation: 1 151

Still waiting for it to display “\”… – manatwork – 2016-11-28T13:09:59.477

@manatwork Oh crap, lazy copy and pasting. Will fix it when I'm back at my desk shortly :) – Pete Arden – 2016-11-28T13:16:10.037

Sorry to see your solution getting longer due to my comment. Can't you use 1>0 instead of true to get it back to 186? – manatwork – 2016-11-28T13:37:52.910

@ErikGolferエリックゴルファー, no idea about C#, but based on the fact the language is a copy of Java and apparently confirmed by Can't cast int to bool, I thought that would not work. (BTW, if that works, maybe using the first call of l() as condition would also work?)

– manatwork – 2016-11-28T14:00:07.923

2@manatwork Well, it seems C# is ungolfable. – Erik the Outgolfer – 2016-11-28T14:01:50.807

@ErikGolferエリックゴルファー I've not given up yet, I will continue to answer PPCG questions in C#! :) – Pete Arden – 2016-11-28T14:15:38.790

@manatwork No worries, it was shorter originally because it was wrong. Looks like 'Snowfire' has got a shorter solution than me now anyway :) – Pete Arden – 2016-11-28T14:16:47.577

@PeteArden Do not give up on this yet, the other answer says that it would have been a comment, so you can ask in the comments if you can use what (s)he did. – Erik the Outgolfer – 2016-11-28T14:19:56.717

@ErikGolferエリックゴルファー But then there'll be two answers the same won't there? – Pete Arden – 2016-11-28T14:20:59.763

@PeteArden Well, I don't know for exact, but I think (s)he might be willing to delete the answer (probably not, though, since the user just got the +10 they needed to be un-sandboxed from that post). You can always ask, though :) – Erik the Outgolfer – 2016-11-28T14:23:11.140

I know it's been almost a year, but you can still golf quite a bit: O=>{Console.Write("Loading...");for(Action<string>l=a=>{Console.SetCursorPosition(11,0);Threading.Thread.Sleep(250);Console.Write(a);};;l("/"),l("-"),l("\\"))l("|");} (173 bytes) Although I think (not entirely sure) it should be 186 bytes for the added using System; for the Console.Write calls. – Kevin Cruijssen – 2017-10-04T13:58:03.620

7

Snap!, 8 blocks

8 blocks of Snap!

This was one of the very first algorithms I ever puzzled out on an Apple ][e

wyldstallyns

Posted 2016-11-27T20:28:55.133

Reputation: 401

1Show us your Applesoft BASIC :) – roblogic – 2016-12-15T21:26:00.957

1I would gladly do these in Hypercard. – wyldstallyns – 2016-12-15T22:01:12.697

6

Perl 6, 72 61 bytes

Supply.interval(1/4).tap: {print "\rLoading... ",<| / - \ >[$/++];$/%=4}
loop {print "\rLoading... ",<| / - \ >[$/++];$/%=4;sleep 1/4}

Brad Gilbert b2gills

Posted 2016-11-27T20:28:55.133

Reputation: 12 713

6

Bash, 98 69 bytes

while s='\|/-';do
printf "\rLoading... ${s:i=++i%4:1}"
sleep .25
done

Thanks to many people for the many bytes golfed off!

Zacharý

Posted 2016-11-27T20:28:55.133

Reputation: 5 710

Also you don't have to escape the backslash if you use single quotes and the arguments for echo -e -n can be combined to echo -en – Evan Chen – 2016-11-28T01:58:39.827

You can save 2 lines and 13 bytes by replacing the echo line to: echo -en "\rLoading... ${s:i=(i+1)%4:1}" – Ipor Sircer – 2016-11-28T02:27:49.787

echo -enprintf; make the assignment to s the while condition. – manatwork – 2016-11-28T09:28:24.233

use printf like manatwork said, simplify the substring, and put it directly in the while condition: while printf "\rLoading... ${s:i++%4:1}";do. 67 bytes – Dominik R – 2016-11-28T12:04:50.470

That won't work Dominik R, it would eventualy overflow. – Zacharý – 2016-11-28T13:33:37.550

It works in bash 4.3.46(1)-release. Ony my x64 system, it goes up to 9223372036854775807, then wraps back to -9223372036854775808 – Dominik R – 2016-11-28T13:44:45.043

6

reticular, noncompeting, 40 bytes

:i=@C"Loading... "o"|/-\\".iHo14%w.i1+4,

enter image description here

I forgot to commit a bunch of things, including w. Oh well.

Explanation

:i=@C"Loading... "o"|/-\\".iHo14%w.i1+4,
:i=                                       set `i` to the TOS
   @C                                     clear the screen
     "Loading... "o                       output that string
                   "|/-\\"                push that string
                          .i              get `i`
                            H             get the `i`th character of that string
                             o            and output it
                              14%         push 0.25 (1/4)
                                 w        wait that long
                                  .i      get `i`
                                    1+    increment
                                      4,  mod 4
                                          this wraps around the beginning of the program,
                                          setting i to the said value

Conor O'Brien

Posted 2016-11-27T20:28:55.133

Reputation: 36 228

6

><>, 55+4 = 59 bytes

"...gnidaoL"v
l?!voc1. ^:<>
<v<>'\|/-'>^v
^<^<<<8{<<^o<

Must be run passing -t .01 as additional argument to the interpreter, that's the +4 in the byte count.

What this does is putting the four characters to be printed on the stack, printing the top one without removing it and shifting the stack by one position. Then it prints \b (backspace, character x08) and restarts the loop.

Timing is achieved by the argument passed to the interpreter, which forces to wait 0.01 second before executing each instruction. There are 23 instructions between an output and the next one (most of them simply move the instruction pointer to the next cell), so this will wait 0.23 seconds plus the time needed for executing the instructions, which fits without problem in the requested 0.25s with 10% error.

You could try it online, but that interpreter doesn't recognize the backspace character, so the output will be a bit strange there.

Leo

Posted 2016-11-27T20:28:55.133

Reputation: 8 482

Normally flags like -n are scored as 1 byte, so I think you can score the argument as t, .01 which is 4 bytes. Nice use of the 10% rule btw :) – FlipTack – 2016-11-28T22:36:31.383

@Flp.Tkc Thank you! I wasn't sure of how to count bytes for the argument, I like this way :) – Leo – 2016-11-29T07:47:40.170

@Leo - Is there a reason for using 0.01 and not a larger tick with less instructions? I've added my version which uses a loop of 8 instructions and the tick count of 0.03; #"...gnidaoL"l?!vob0. "|/-":o}8o51. ># – Teal pelican – 2016-12-02T11:14:06.853

@Tealpelican There is a reason, but it's not a very good one: the rules state that "You should not wait 0.25 seconds before initially showing output - the first frame should be printed as soon as the program is run.", so I didn't want to make the timer too long, while on the other hand this is code golf, so I didn't want to make it too short. In the end I decided for a 25 instruction loop taking 0.01s each to achieve the exact timing of 0.25s requested; when I implemented it, though, I realized that I lacked enough space for the full loop, so I had to resort to using the 10% rule. – Leo – 2016-12-02T13:48:31.167

I must have misread the rules. That is a perfectly good reason for the timing :) – Teal pelican – 2016-12-02T14:30:51.907

6

MS-DOS .COM file, 56 bytes

Here the file content in hexadecimal:

b4 09 ba 2c 01 cd 21 b2 2f e8 11 00 b2 2d e8 0c
00 b2 5c e8 07 00 b2 7c e8 02 00 eb ea b4 02 cd
21 b2 08 cd 21 b9 05 00 f4 e2 fd c3 4c 6f 61 64
69 6e 67 2e 2e 2e 20 24

The matching assembler code looks like this:

    mov ah, 9      ; Print "Loading... "
    mov dx, text
    int 21h
theloop:
    mov dl, '/'    ; Call "chrout" for "/", "-", "\" and "|"
    call chrout
    mov dl, '-'
    call chrout
    mov dl, '\'
    call chrout
    mov dl, '|'
    call chrout
    jmp theloop    ; Endless loop

chrout:            ; Sub-Function "chrout"
    mov ah, 2      ; Output the character
    int 21h
    mov dl, 8      ; Output backspace
    int 21h
    mov cx,5       ; Call "HLT" 5 times
timeloop:
    hlt            ; Normally HLT will wait ~55 milliseconds
                   ; (Assuming no keyboard key is pressed)
    loop timeloop
    ret            ; End of the function

text:
    ASCII "Loading... ",'$'

Martin Rosenau

Posted 2016-11-27T20:28:55.133

Reputation: 1 921

1Keeping a key pressed accelerates the spinner, which can be fixed by masking interrupts other than the timer interrupt, e.g.: mov al, 0xfe / out 0x21,al – ninjalj – 2016-11-29T20:12:07.297

The comment for HLT is wrong, you probably meant that HLT wakes up at ~18.2 Hz (or, more precisely, at NTSC clock/12/65536 Hz). – ninjalj – 2016-11-30T21:46:50.257

@ninjalj Thanks. I changed the comment... – Martin Rosenau – 2016-12-01T06:23:59.153

6

NASM x86_64 - 349 283 bytes

This should be run 64 bit linux systems

built using:

nasm loading_golfed.asm -felf64 && ld loading_golfed.o

%use altreg
global _start
section .data
o:db"Loading...  "
s:db"|/-\\"
b:db`\bx`
q:dq 0,250000000
_start:mov r0,1
mov r7,1
mov r6,o
mov r2,12
syscall
mov r2,2
l:mov r7,1
mov al,[s+r8]
mov [b+1],al
mov r0,1
mov r6,b
syscall
mov r0,35
lea r7,[q]
mov r6,0
syscall
inc r8
and r8,3
jmp l

animation:

saved 65 bytes - thanks user254948

enter image description here

Samuel

Posted 2016-11-27T20:28:55.133

Reputation: 191

I count 349 bytes, unless there's a trailing newline/space – FlipTack – 2016-11-29T21:37:35.987

^Flp. Tkc Thanks, there was a line with a space at the end – Samuel – 2016-11-29T21:40:37.923

@Samuel are lines 13-17 needed? It seems to work pretty much fine without those lines. As far as I can tell (Not that great in assembly I'm afraid) you print the Loading...., then the | character, then remove that character, then enter a loop where you repeat printing the | for the first time. – user254948 – 2016-12-01T13:44:04.167

@Samuel in addition xor r8,r8 -> mov r8,0 (saves 1 character), some MOV's have an extra space (mov r7, 1 -> mov r7,1). further more the instructions cmp r8,4, jl l, xor r8,r8, can be replaced by AND r8,3 (saving 15 characters). You should be down to 285 bytes then instead of 349! (in combination with the lines mentioned above) – user254948 – 2016-12-01T14:27:29.507

5

R, 85 89 bytes

repeat{if(T>4)T=1;cat("\fLoading...",c("|","/","-","\\")[T],sep="");T=T+1;Sys.sleep(.25)}

Edit: Fixed the answer such that T wont overflow by resetting the counter if greater than 4.

The only interesting aspect about this answer is the use of R's TRUTHY builtin T. It is effectively a predefined variable set to 1/TRUE which means we don't have to initialize the counter but can start incrementing T.

Billywob

Posted 2016-11-27T20:28:55.133

Reputation: 3 363

Would T eventually overflow? – FlipTack – 2016-11-28T08:13:43.603

@Flp.Tkc It wouldn't overflow but be treated as infinity past 1e+308 in which case NA is returned so I guess this answer is invalid then (didn't notice it in the rules). Will update soon – Billywob – 2016-11-28T08:47:39.047

1Actually you can get it 2 bytes shorter if you don't use the built-in T: i=1;repeat{cat("\rLoading...",c("\\","|","/","-")[i]);Sys.sleep(.25);i=`if`(i>3,1,i+1)} is 87 bytes. – plannapus – 2016-11-29T16:15:59.517

Hmm ... does R only operate on vectors? Why are there no modulo or bitwise operators for atoms? is T a vector? Does T=(T+1)%%4 work? It would save another 5 bytes. – Titus – 2016-12-04T13:24:57.760

@Titus In R, indexing is 1-based (meaning here one has to cycle T between 1, 2, 3 and 4; not 0, 1, 2, and 3) so what you propose won't work as if T=3, (T+1)%%4 is 0 which would index nothing. (Which could be solved by indexing with T+1 instead of T of course). – plannapus – 2016-12-08T14:50:18.117

2... or T=T%%4+1: even 2 bytes shorter. – Titus – 2016-12-08T14:58:07.310

79 bytes :) – Giuseppe – 2017-10-04T13:59:48.807

5

Haskell (GHC), 103 91 bytes

import GHC.Conc
mapM((>>threadDelay 250000).putStr)$("\rLoading... "++).pure<$>cycle"|/-\\"

Thanks @nimi for saving 12 bytes!

Angs

Posted 2016-11-27T20:28:55.133

Reputation: 4 825

No need for a full program. mapM((threadDelay 250000>>).putStr)$("\rLoading... "++).pure<$>cycle"|/-\\". – nimi – 2016-11-28T13:11:06.880

Two bytes might be saved by using the 10% tolerance and replacing 250000 and the space before it with (4^9). – Christian Sievers – 2016-11-29T03:45:13.457

5

Perl, 71 63 61 bytes

s//\rLoading... |/;select$\,$\,$\,y'-|\/'\/|-'/4while$|=print

Previous version:

$_="\rLoading... |";{$|=print;y#|/\-\\#/\-\\|#;select$\,$\,$\,.25;redo}

Thanx to @primo for 10 bytes.

Denis Ibaev

Posted 2016-11-27T20:28:55.133

Reputation: 876

2Nice trick to use the select timeout rather than Time::HiRes. You can save a few bytes by using ... while$|=print, and by moving the hyphens in the transliteration to the front and the end. s//\r Loading... |/ also saves a byte over assignment. – primo – 2016-11-28T12:41:33.737

2And also, if you use single quotes for the transliteration delimiter, there's no need to escape the backslash either: y'-\|/'\|/-'. – primo – 2016-11-28T12:48:01.527

It seems you have an extra space before your code. – Erik the Outgolfer – 2016-11-28T13:48:45.537

1You can save another byte by using a literal \r. – ninjalj – 2016-11-28T19:26:55.997

1Use y'-|\/'\/|-'/4 in place of .25 for 2 more. – primo – 2016-11-30T06:38:31.050

A bit more refactoring: select$\,$\,$\,'-\|/'=~/./g/4while$|=print"\rLoading... $&" – primo – 2016-11-30T08:30:44.750

5

C (on UNIX-like systems) 88 bytes

main(_){for(;;){_%=4;printf("\rLoading... %c","\\-/|"[_++]);fflush(0);usleep(250000);}}

It starts with the wrong character, but I think it looks nicer. You can easily change the character order by modifying the "\-/|" string.

LambdaBeta

Posted 2016-11-27T20:28:55.133

Reputation: 2 499

Could be golfed further by moving statements into for, e.g: ain(_){for(;printf("\rLoading... %c","\\-/|"[_%4]);usleep(250000))_++,fflush(0);}, then could be golfed further assuming wraparound for integer overflow: main(_){for(;printf("\rLoading... %c","\\-/|"[_++%4]);usleep(250000))fflush(0);} – ninjalj – 2016-11-29T00:20:35.153

Do you need the fflush() in there? – John U – 2016-12-02T11:30:55.073

On most systems you do need the fflush, many of them buffer based on newlines. However it is possible that it isn't necessary on some systems. – LambdaBeta – 2016-12-02T17:48:33.570

You could use fprintf(stderr,... instead, since that is not line buffered like stdout. The f...stderr, takes eight characters, while the fflush(0); takes ten, so it's a net win of two characters. – cmaster - reinstate monica – 2016-12-28T10:58:17.417

4

Ruby, 66 59 58 57 bytes

I saved 7 bytes when I remembered ruby's loop syntax. -1 byte thanks to manatwork (changed print to $><<)! -1 byte thanks to daniero!

loop{$><<"Loading... #{'|/-\\'[$.=-~$.%4]}\r";sleep 0.25}

Decently self-explanatory. Uses the nice fact that '...' strings don't need to have double-escapes I had to rework the string, so now the \ is at the end and must be escaped.

Conor O'Brien

Posted 2016-11-27T20:28:55.133

Reputation: 36 228

print$><< – manatwork – 2016-11-28T09:30:47.320

@manatwork Oh, cool! – Conor O'Brien – 2016-11-28T12:09:21.293

You can use $. instead of initializing i, as explained here. Saves at least two bytes

– daniero – 2016-11-30T17:43:17.803

4

PHP, 58 bytes

for(;;usleep(25e4))echo"\rLoading... ","\\|/-"[$i=++$i%4];

uses carriage return = overwrites the whole line. Run with -r.

Titus

Posted 2016-11-27T20:28:55.133

Reputation: 13 814

@user59178: The assignment is needed to avoid integer overflow. Can you tell me how to run code with single and double quotes with -r? – Titus – 2016-11-28T14:29:01.713

Those are both excellent points, I probably should have actually tried running it, rather than just looking at the code.:-) – user59178 – 2016-11-28T15:36:03.247

1On 64-Bit php, it would take over 73 billion years to overflow. I think that's acceptably close to forever. Also, 57, no -r required: Loading... <?for(;;usleep(25e4))echo'\|/-'[$i=++$i%4],~÷; – primo – 2016-12-02T12:45:38.040

@primo: I tried ^H, but it doesn´t seem to expand to chr(8) everywhere. And no idea what it depends on. – Titus – 2016-12-08T15:52:22.047

If using -r, it will likely depend on the terminal. – primo – 2016-12-08T19:54:12.917

4

Java, 173 115 bytes

  • Version 2.0

Changed to lambda function/Thanks to @Xanderhall and @manatwork/115 bytes:

()->{System.out.print("Loading...  ");for(int i=0;;Thread.sleep(250))System.out.print("\b"+"\\|/-".charAt(i++&3));}
  • Version 1.0

Initial Version/173 bytes:

class A{public static void main(String[]a)throws Exception{System.out.print("Loading...  ");for(int i=0;;){System.out.print("\b"+"\\|/-".charAt(i++%4));Thread.sleep(250);}}}

Roman Gräf

Posted 2016-11-27T20:28:55.133

Reputation: 2 915

6“Your program should be able to run indefinitely.” – This will terminate when reaches Integer.MAX_VALUE after 17++ years with “java.lang.StringIndexOutOfBoundsException: String index out of range: -3”. – manatwork – 2016-11-28T11:08:39.103

Can't test but will it i&3 do? – Roman Gräf – 2016-11-28T14:27:26.620

1Also, you are allowed to submit a function. You can get rid of the class declaration and just have void a(){myfunction} format. – Xanderhall – 2016-11-28T14:39:29.530

4

Pascal, 116 114 107 105 bytes

where is my head.. Thanks to @manatwork for shaving few bytes!

uses crt;var c:char;begin while 1=1do for c in'|/-\'do begin Write(#13'Loading... ',c);Delay(250)end;end.

Ungolfed:

uses
  crt;    // CRT unit has Delay function

var
  c: char;

begin
  while 1=1 do
    for c in '|/-\' do
    begin
      Write(#13'Loading... ', c);
      Delay(250)
    end;
end.

hdrz

Posted 2016-11-27T20:28:55.133

Reputation: 321

1True1=1 and that way you can remove the following space too. – manatwork – 2016-11-28T10:26:44.057

1Better use a single output statement rewriting the entire line: Write(#13'Loading... ',c);. (BTW, no need for , between character and string literals.) – manatwork – 2016-11-28T10:32:51.680

@manatwork - thanks, that makes more sense – hdrz – 2016-11-28T10:34:59.630

Oh, and no need for the ; in front of 1st end. – manatwork – 2016-11-28T10:38:03.903

Got it. have to eat something.... – hdrz – 2016-11-28T10:57:54.083

4

Noodel, noncompeting 24 25 bytes

Cannot compete because Noodel was born after the challenge.

”|gAĖọẸ.?a5‘|/-\⁺ʂḷạÇḍ/4

Had to add a byte because messed up the compression algorithm:(

“Loading...¤‘|/-\⁺ʂḷạÇḍ/4

Try it:)

How it works

“Loading...¤              # Creates a string that is "Loading...¤" that is placed into the pipe.
            ‘|/-\         # Creates a character array ["|", "/", "-", "\"]
                 ⁺ʂ       # Adds two items in the pipe which will add the string to each character in the array. The 'ʂ' forces it to prepend rather than append.
                   ḷ      # Unconditionally Loop everything up until a new line or end of program.
                    ạ     # Basic animation, iterates through an object moving to the next index every call on that object and returns what is at that index.
                     Ç    # Clears the screen then prints what is in the front of the pipe and dumps what was displayed.
                      ḍ/4 # Delays for the specified amount of time (/4 => 1/4 => 0.25s)

Stepping The Pipe

-->
--> "Loading...¤"
--> ["|", "/", "-", "\"], "Loading...¤"
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]
Loop ----------------------------------------------------------------------------------------
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]
--> "Loading...¤|", ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:0>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:0>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:0>
Loop ----------------------------------------------------------------------------------------
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:0>
--> "Loading...¤/", ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
Loop ----------------------------------------------------------------------------------------
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
--> "Loading...¤-", ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
Loop ----------------------------------------------------------------------------------------
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
--> "Loading...¤\", ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:3>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:3>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:3>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:3>

There currently is not a version of Noodel that supports the syntax used in this answer. Here is a script that is supported:

23 bytes

Loading...¤”Ƈḟḋḣ⁺sḷạÇḍq

<div id="noodel" code="Loading...¤”Ƈḟḋḣ⁺sḷạÇḍq" input="" cols="12" rows="2"></div>

<script src="https://tkellehe.github.io/noodel/release/noodel-1.1.js"></script>
<script src="https://tkellehe.github.io/noodel/ppcg.min.js"></script>

tkellehe

Posted 2016-11-27T20:28:55.133

Reputation: 605

This is a pretty neat language. Welcome to PPCG :) – FlipTack – 2016-12-28T00:01:24.583

@FlipTack Thank you:) This place is like a giant playground:)lol – tkellehe – 2016-12-28T00:40:52.030

3

Wonder, 50 bytes

f\@(ol ++"�Loading... ":#0"\|/-";%%25e4;f +1#0);f0

Replace with the actual carriage return \r.

Explanation

f\@(...);f0: Infinitely recursive function f.

:#0"\|/-": Modular indexing using the function argument and the string "\|/-".

ol ++"�Loading... ": Return cursor to beginning of line, concatenate previous result to Loading..., and output.

%%25e4: Sleep for 250000 nanoseconds.

f +1#0: Call f on the argument incremented.

Mama Fun Roll

Posted 2016-11-27T20:28:55.133

Reputation: 7 234

Would this reach maximum recursion depth and crash? – FlipTack – 2016-11-29T06:51:42.103

I don't think so, although I haven't tried running it for very long. Sort of weird, given that I should know how the interpreter works. – Mama Fun Roll – 2016-11-29T06:56:07.510

3

C#, 165 123 bytes

Quite a few bytes saved thanks to raznagul !

z=>{Console.Write("Loading... ");for(int i=0;;i++){Console.Write(@"|/-\"[i%=4]+"\b");System.Threading.Thread.Sleep(250);}};

Anonymous function with no return type. The integer parameter z is only used as a placeholder in order to slash 1 byte off.

If input was allowed, the value 0 (or any other multiple of 4 to start from the same character) could be used as the iterator, reducing the byte count to 116 bytes:

i=>{Console.Write("Loading... ");for(;;i++){Console.Write(@"|/-\"[i%=4]+"\b");System.Threading.Thread.Sleep(250);}};

Full program with ungolfed function:

using System;

public class Program
{
    public static void Main()
    {
        Action<int> a = z =>
        {
            Console.Write("Loading... ");
            for (int i=0;;i++)
            {
                Console.Write(@"|/-\"[i%=4]+"\b");
                System.Threading.Thread.Sleep(250);
            }
        };

        a(0);
    }
}

No GIF for now, since I'm having trouble with some dependencies on a slightly older Linux distro... The cursor is displayed on the last character, this behavior can be changed by adding a space in the Loading... string.

adrianmp

Posted 2016-11-27T20:28:55.133

Reputation: 1 592

I think this doesn't fulfill the third rule a i++ will eventually throw an overflow exception. – raznagul – 2016-11-28T15:41:28.460

2It won't overflow, since i is assigned the modulo of division by 4 when printing the line (i%=4). – adrianmp – 2016-11-28T15:57:00.730

1+1 this is indeed clever. You can save a lot of bytes by printing Loading once and then printing "\b" instead of setting the cursor position. Also you don't have to define r. You can use @"|/-\"[...] instead. – raznagul – 2016-11-28T16:10:26.923

1I don't know if it is allowed. But you add on byte for the initialization of z and then you z instead of i, in total saving 6 bytes. – raznagul – 2016-11-28T16:16:24.360

3

Befunge, 60 bytes

"  ...gnidaoL">:#,_v
"|/"<v*:*6"}",,8< 
"\-"^>:#->#1_$:#^  _

Since Befunge doesn't have anything like a sleep command, the delay is approximated with a long running loop. This will obviously need to be adjusted depending on the speed of the system on which it is run.

You can test it on the codingground website.

James Holderness

Posted 2016-11-27T20:28:55.133

Reputation: 8 298

3

Befunge 98, 61 bytes

Requires the HRTI (High Resolution Timers) fingerprint.

"ITRH"4(v
"g2:%4+1<,M',*93,aj*-d0`T**::?'M,kb"Loading...
|/-\

Waits 250047 (63^3) microseconds using a busy loop, using the M (mark) and T (returns the number of microseconds since the last mark) instructions from the "HRTI" fingerprint.

After each line, it outputs "\n\eM", to force a flush, and reposition the cursor.


Version for terminals using 8-bit encodings with proper support for C1 control codes (59 bytes):

"ITRH"4(v
"g2:%4+1<,+f~',aj*-d0`T**::?'M,kb"Loading...
|/-\

This version outputs "\n\x8d" after each line. "\x8d" is the 8-bit equivalent of 7-bit "\eM", and is supported by e.g: xterm +u8 (xterm not in UTF-8 mode).

ninjalj

Posted 2016-11-27T20:28:55.133

Reputation: 3 018

3

Batch, 88 81 77 bytes

:1
@FOR %%G IN (/,-,\,^|) DO @(echo Loading...%%G
timeout/t 1 >a
cls)
@goto 1

GIF

(My first answer on Code Golf...)

rahuldottech

Posted 2016-11-27T20:28:55.133

Reputation: 141

The @echo off line is costing you ten bytes. Would it be cheaper to simply place an @ on each command individually? Or is there some reason that doesn't work? – None – 2016-12-04T08:48:11.543

@ais523 It's giving me some errors... I'm working on it – rahuldottech – 2016-12-04T08:50:11.577

@ais523 Done! Turns out if you're using DO ( ) with FOR, you just need to put a single @: DO @( ) – rahuldottech – 2016-12-04T08:57:00.630

1Since nobody's said it, welcome to code-golf! Nice answer – FlipTack – 2016-12-04T16:29:40.980

Still better than my 100-byte bash answer! – ckjbgames – 2017-02-03T15:13:52.543

3

PowerShell, 116 77 69 67 bytes

for(){[char[]]'|/-\'|%{write-host -n `rLoading... $_;sleep -m 250}}

cleaner than cls?

Daniel Cheng

Posted 2016-11-27T20:28:55.133

Reputation: 51

1Welcome to PPCG! – FlipTack – 2016-12-15T19:14:05.450

3

ES8 + HTML, 68 bytes

setInterval(e=>a.innerHTML='|/-\\'[++i%4],i=250)
Loading... <a id=a>-

copyreplace

Posted 2016-11-27T20:28:55.133

Reputation: 31

2

C++11, 209 207 180 175 164 bytes

This might have been a good use for the new C++ literals, saving std::chrono::milliseconds(250) to just write 250ms or 0.25s, but unfortunately this requires using namespace std::chrono; which is longer in the end.

-2 bytes thanks to Flp.Tkc for using #import instead of #include. Saving lot more thanks to Flp.Tkc, learning about \r and \b. -2 bytes thanks to myself for c[++i%=4]. -5 bytes thanks to Roman Gräf. -9 bytes thanks to kvill for indexing into the string literal directly.

#import<iostream>
#import<thread>
int main(int i){A:std::cout<<"\rLoading... "<<"|/-\\"[++i%=4];std::this_thread::sleep_for(std::chrono::milliseconds(250));goto A;}

Golfed your initial example. If it does not work in your console, you have to add <<flush to see any output for +7 bytes.

Ungolfed:

#import <iostream>
#import <thread>

int main(int i) {
    A:
        std::cout << "\rLoading... " << "|/-\\"[++i%=4];
        std::this_thread::sleep_for(std::chrono::milliseconds(250));
    goto A;
}

Karl Napf

Posted 2016-11-27T20:28:55.133

Reputation: 4 131

Will i overflow? – Zacharý – 2016-11-28T13:43:13.093

@ZacharyT Ah, yes it would and negative % positive = negative in C++. Rolled back. – Karl Napf – 2016-11-28T14:15:46.100

Wouldn't it be shorter to remove using namespace std; and replace that with std:: or is this_thread also std:: – Roman Gräf – 2016-11-28T14:34:47.247

1Tip: use #import<...> to save a couple bytes :) – FlipTack – 2016-11-28T15:08:19.617

@Flp.Tkc thanks! 2 bytes to be exact and some warnings, but hey ;) Might edit some of my previous answers, although most times I circumvented #include by assuming a string or vector<int> as input to a generic function. – Karl Napf – 2016-11-28T15:20:32.500

Good idea using i as an argument, I didn't think of that. To shave some more bytes, you can rename cycle to c. And, rather than printing twice, just change the one in A: to cout<<"\rLoading... "<<c[i++];. My console didn't need the flush either. – FlipTack – 2016-11-28T16:22:44.750

@Flp.Tkc Thanks again. That `'\r'' is great. – Karl Napf – 2016-11-28T16:31:18.480

@RomanGräf Yes, this_thread was also in std:: and using it 4 times is the same as using namespace std, but now that I dropped flush it is shorter with 3 times std:: – Karl Napf – 2016-11-28T16:35:04.837

1No need to define c, just use ...<<"|/-\\"[++i%=4] for another couple of bytes. – kvill – 2016-11-28T18:47:38.667

1@kvill Thanks! That feels a little pythonish. – Karl Napf – 2016-11-28T19:03:14.223

Is there an std::chrono::seconds(0.25)? – Cyoce – 2016-11-29T15:39:44.367

2

Ruby, 75 72 bytes

$><<'Loading...  '
c='|/-\\'.chars
loop{$><<?\b+c.rotate![0]
sleep 0.25}

Cyoce

Posted 2016-11-27T20:28:55.133

Reputation: 2 690

2

Nim, 81 80 bytes

import os
while 1>0:
 for c in "|/-\\":stdout.write("\rLoading... ",c);sleep 250

This may require flushing with stdout.flushFile in some terminals.

kvill

Posted 2016-11-27T20:28:55.133

Reputation: 329

don't know nim but can't you write the for loop directly after the while 1>0;? Also can you maybe remove the whitespace between in and '|/-\\":? – Roman Gräf – 2016-11-28T20:00:50.683

@RomanGräf Thanks, but those changes are beyond Nim! – kvill – 2016-11-28T20:53:27.193

2

T-SQL, 239 182 162 159 153 152 149 bytes

Golfed:

DECLARE @c CHAR(5)='|/-\',@s CHAR,@ INT WHILE 1=1BEGIN SET @=1WHILE @<4BEGIN SET @s=(SELECT SUBSTRING(@c,@,1))PRINT'Loading... '+@s SET @=@+1 END END

Ungolfed

DECLARE @c CHAR(5) = '|/-\',
        @s CHAR(1),
        @ INT;
WHILE (1 = 1)
BEGIN
    SET @ = 1;
    WHILE (@ < 4)
    BEGIN
        SET @s = (SELECT SUBSTRING(@c, @, 1));
        PRINT 'Loading... ' + @s;
        SET @ = @i + 1;
    END
END

Nelz

Posted 2016-11-27T20:28:55.133

Reputation: 321

Maybe you should try golfing this? – Cyoce – 2016-11-29T16:08:12.057

@Cyoce down to 182. – Nelz – 2016-11-29T16:22:03.107

2

Mathematica, 90 bytes 85 bytes

Significantly longer than A Simmons' answer, but with fewer visual frills.

t=0;RunScheduledTask[t=Mod[t+1,4],1/4];Dynamic["Loading... "<>"|"["/","-","\\"][[t]]]

Loading

ngenisis

Posted 2016-11-27T20:28:55.133

Reputation: 4 600

Wow! "|"["/", "-", "\\"][[t]] looks awesome. nice one! :) – Dan Oak – 2016-11-29T04:54:42.877

2Nice job! I count only 86 bytes (using the two-byte [[ and ]] instead of the three-byte and ). You can also save a byte with 1/4 in place of 0.25. – Greg Martin – 2016-11-30T05:47:49.607

2

C, 119 118 102 91 88 bytes

#import<windows.h>
i;f(){for(;;)Sleep(19*printf("\rLoading... %c","\\|/-"[i=(i+1)%4]));}

Steadybox

Posted 2016-11-27T20:28:55.133

Reputation: 15 798

1Could char *c be char*c? – Zacharý – 2016-11-28T21:20:40.493

@ZacharyT Yes, it could. Thanks! – Steadybox – 2016-11-28T21:27:44.030

1Can you move the assignment into the index, for(;;){printf("\b%c",c[i=i>2?0:i+1])...? – Zacharý – 2016-11-28T21:39:03.297

1Have a look at my submission... i=i>2?0:i+1 is identically i=(i+1)%4. He can use incrementation in the index, then modulo in the loop. – LambdaBeta – 2016-11-28T21:41:08.183

1He can also save a byte (I think) by completely flushing with \r so he doesn't need the extra space in the "Loading... " string. – LambdaBeta – 2016-11-28T21:42:50.680

1I don't know C, but would i=++i%4 work? – FlipTack – 2016-12-28T18:04:57.567

@FlipTack Yes, it does. Thank you! – Steadybox – 2016-12-28T18:58:39.037

@FlipTack Or at least it seemed to work, but I just now realised that it's undefined behaviour, so I reverted back to the (i+1) thing. – Steadybox – 2016-12-29T17:46:23.917

2

Clojure, 93 92 bytes

#(do(print"Loading... -")(doseq[c(cycle"\\|/-")](print(str"\b"c))(flush)(Thread/sleep 250)))

Basically the Haskell answer (I swear I didn't cheat!).

It must be run in a console. IDE's REPL (Intellij) just prints a garbage character in place of the "\b".

And it's late, and I've never even created a GIF before, so I'm going to have to pass on that part.

Carcigenicate

Posted 2016-11-27T20:28:55.133

Reputation: 3 295

2

PowerShell 57 Bytes

for(){'|','\','-','/'|%{"loading...$_";sleep -m 250;cls}}

jyao

Posted 2016-11-27T20:28:55.133

Reputation: 131

2Welcome to PPCG! You can save a byte by using a char array instead of explicitly calling out each character -- [char[]]'|\-/' – AdmBorkBork – 2016-11-29T16:53:11.140

Right, @TimmyD, Thx! – jyao – 2016-11-29T17:21:45.007

2

Dyalog APL, 45 bytes

Uses instead of -.

{⍵⊣⎕DL÷4⊣⍞←⍵,⍨⊃⎕TC}¨⍣≢'|/─\'⊣⍞←'Loading...  '

Loading...

⍞←'Loading... ' print the string without newline

'|/─\'⊣ replace it with the string of bars

{...}¨⍣≢ indefinitely apply the below function on each character

⊃⎕TC first Terminal Control character (backspace)

⍵,⍨ prepend the argument (a bar character)

⍞← output that without newline (this overwrites the previous bar)

4⊣ replace that with a four

÷ invert that (yielding 0.25)

⎕DL DeLay that many seconds

⍵⊣ replace with (and return) the original argument

Adám

Posted 2016-11-27T20:28:55.133

Reputation: 37 779

2

Turing machine simulator, 189 bytes

0 * L r 1
1 * o r 2
2 * a r 3
3 * d r 4
4 * i r 5
5 * n r 6
6 * g r 7
7 * . r 8
8 * . r 9
9 * . r A
A * * r B
B - \ * C
B / - * C
B | / * C
B * | * C
C * * * D
D * * * E
E * * * F
F * * * B

Do not run on full speed, or it will not wait for ~0.25 s1.

1Dunno if actually within 10% of 0.25 s. Last 4 lines do the waiting job approximately.

Erik the Outgolfer

Posted 2016-11-27T20:28:55.133

Reputation: 38 134

2

TI-Basic (CE/CSE only), 57 bytes

:ClrHome
:Disp "LOADING...
:For(A,1,5
:A-4(A=5→A
:Output(1,12,sub("+/-*",A,1
:Pause .25
:End

Notes:

  • Many commands in TI-Basic are 1-2 byte tokens, which may make it appear to be a byte miscount.

  • Due to TI-Basic's very limited character set, the following characters have been replaced: |\ with +*.

  • This will only run correctly on the newest version of a TI-84+ CE or CSE.

Julian Lachniet

Posted 2016-11-27T20:28:55.133

Reputation: 3 216

2

Commodore 64 (or VIC-20), 123 Bytes

0 A$="/|\-":A=1:FORI=0TO1STEP0:PRINT"{home}LOADING..."MID$(A$,A,1):A=A+1:GOSUB2:ON-(A>4)GOTO0
1 NEXT
2 FORX=0TO99:NEXT:RETURN

Using print 38911-(fre(0)-65536*(fre(0)<0)) tells me that I have consumed 123 bytes of the computers memory (on the C64); this will probably work on other variants of Commodore BASIC, such as the BASIC 7; you will need to use BASIC keyword abbreviations to enter it on a real C64 or VIC-20.

The BASIC listing from an emulator screen grab

In order to make it infinite*, you will need to disable the RUN/STOP key with a POKE, I think it's POKE 808,234 - that will mean you can't break into the BASIC listing without an Action Replay or a soft reset or something. The time delay can be altered in line 2 - increase the FOR X counter as required.

Shaun Bebbers

Posted 2016-11-27T20:28:55.133

Reputation: 1 814

2

C++, 109 Bytes

There should be a lot to improve, it's my first golf code. Feedback is greatly appreciated :)

#import<stdio.h>
#import<unistd.h>
int b;main(){for(;;usleep(2500))printf("\rLoading...%c","-\\|/"[++b%=4]);}

Clémox

Posted 2016-11-27T20:28:55.133

Reputation: 41

2

C function, 73 bytes

i;f(){for(;write(1,"\rLoading... -\b\\\b|\b/",13+i%8);i++)usleep(1<<17);}

Tested on SystemResque-Cd 4.9.6 in this program:

#include <stdio.h>
#include <unistd.h>

/*
i;
f(){
        for(
            ;
            write(1, "\rLoading... -\b\\\b|\b/", 13+i%8);
            i++
        ){
                usleep(1<<17);
        }
}
*/
i;f(){for(;write(1,"\rLoading... -\b\\\b|\b/",13+i%8);i++)usleep(1<<17);}

int main(){
        f();
        return 0;
}

compiled with gcc 4.9.4

epimatech

Posted 2016-11-27T20:28:55.133

Reputation: 21

Welcome to the site! – James – 2017-05-25T22:22:39.203

2

Charcoal, 34 bytes

Loading... A⁰αHW²⁵⁰¦¹«A⁺¹ααP§|/-\α

Try it online! Refresh command has changed since so it is different on TIO. Link to verbose code for explanation.

ASCII-only

Posted 2016-11-27T20:28:55.133

Reputation: 4 687

2

Java 7, 121 118 bytes

void f()throws Exception{for(int k=0;;k++){System.out.print("\rLoading... 
"+"|/-\\".charAt(k%=4));Thread.sleep(250);}}

Gif animation:

enter image description here

Twometer

Posted 2016-11-27T20:28:55.133

Reputation: 281

1

Bash, 62 bytes

c='|/-\';for((;;)){ echo Loading... ${c:d++%4:1}^[M;sleep .25;}

where ^[ represents ESC (ASCII 0x1b), which typically you can get by pressing CtrlV and then ESC.

ESC M is RI, reverse linefeed.

If you don't care about running indefinitely, you can save 2 bytes by using a recursive function:

c='|/-\';f(){ echo Loading... ${c:d++%4:1}^[M;sleep .25;f;};f

ninjalj

Posted 2016-11-27T20:28:55.133

Reputation: 3 018

1

JavaScript (ES6), 90 bytes

(F=(i=0)=>{(c=console).clear();c.log('loading... '+'|/-\\'[i]);setTimeout(F,250,-~i%4)})()

George Reith

Posted 2016-11-27T20:28:55.133

Reputation: 2 424

2i will eventually overflow, since it just keeps going up without modulation. This can be fixed at no cost with c.log('loading... '+'|/-\\'[i]);setTimeout(F,250,-~i%4) – ETHproductions – 2016-11-29T01:58:33.470

3@ETHproductions Good catch, the poor user would only have to wait a mere 71 billion years. – George Reith – 2016-11-29T12:17:59.850

1

HTML/CSS 135 Bytes

Like my previous answer, but doesn't use a monospace font, saving 6 bytes (not 100% if that's allowed, so I separated the answers for separate voting).

Update - a non monospace font is allowed. This works!

@keyframes l{0%{content:'|'}25%{content:'/'}50%{content:'-'}75%{content:'\\'}}a:after{animation:l 1s infinite;content:'|'}
<a>Loading... 

Ben Aubin

Posted 2016-11-27T20:28:55.133

Reputation: 121

The 0% frame seems unnecessary. – manatwork – 2016-11-29T08:41:16.200

@manatwork there so that it can repeat infinitely. – Ben Aubin – 2016-12-13T18:53:30.330

1

Node, 72 bytes (70 with literal)

c=0;setInterval(_=>console.log('\x1BcLoading... '+'/-\\|'[c=-~c%4]),250)

If you replace \x1B with the literal escape character you can cut another 2 bytes. You don't need to call anything.

Piotr Wegner

Posted 2016-11-27T20:28:55.133

Reputation: 11

1Would setInterval(_=>console.log('\x1BcLoading... '+'/-\\|'[c=-~c%4]),c=250) work since c is being mod-ed by four every time? – Zacharý – 2016-11-29T22:12:05.533

1

Python 3, 86 83 bytes

GIF to follow. Golfing suggestions welcome as this is still a little verbose. -3 bytes thanks to Flp.Tkc.

import time
i=1
while i:print(end="\rLoading... "+"/-\|"[i%4]);time.sleep(.25);i+=1

Sherlock9

Posted 2016-11-27T20:28:55.133

Reputation: 11 664

You can stick the \r before the Loading to save the costly bytes for end=. Note that this solution is extremely similar

– FlipTack – 2016-11-30T17:40:43.520

@Flp.Tkc I could have sworn that there were no other Python answers on here. Thanks for the heads up. Also, that tip doesn't work as Python 3's print has the default end of \n which screws up the updating. Thanks anyway. – Sherlock9 – 2016-11-30T18:03:47.890

In that case you could do print(end="\rLoading... "+"/-\|"[i%4]) – FlipTack – 2016-11-30T21:40:29.473

1

F# (interactive), 81 bytes

async{while 1>0 do for c in"|/-\\"do printf"\rLoading... %O"c;do!Async.Sleep 250}

In order to run it in F# interactive, you have to pass it to Async.Start or Async.RunSynchronously.

For reference, a little longer non-async version:

while 1>0 do for c in"|/-\\"do printf"\rLoading... %O"c;System.Threading.Thread.Sleep 250

and a slightly outdated gif :)

enter image description here

pmbanka

Posted 2016-11-27T20:28:55.133

Reputation: 171

1Welcome to PPCG. Nice answer :) – FlipTack – 2016-12-03T22:26:23.027

1

Python 3, 94 bytes

Okay. First answer. EDIT: SAVED 8 BYTES EDIT 2: SAVED 1 BYTE EDIT 3: SAVED 11 BYTES EDIT 4: SAVED 3 BYTES EDIT: SAVED 5 BYTES EDIT: SAVED 2 BYTES

import time
while 1:
 for f in 0,1,2,3:print("Loading...","|/-\\"[f],end="\r");time.sleep(.25)

Ungolfed:

import time
while True: # Loop forever
    for f in [0, 1, 2, 3]: # Loop four times
    print("Loading...", "|/-\\"[f], end="\r") # Print Loading... then the current frame
        time.sleep(0.25) # Wait 0.25 seconds

python-b5

Posted 2016-11-27T20:28:55.133

Reputation: 89

1

Welcome to PPCG! Nice answer, although there is a shorter python solution here. You might want to see tips for golfing in python so you can make your future answers shorter :)

– FlipTack – 2016-12-23T20:42:58.957

I see you have a bit of extra whitespace particularly f += 1 can be replaced with f+=1 and f >= 3 can become f>=3. Additionally 0.25 can be replaced with .25 – Post Rock Garf Hunter – 2016-12-23T20:52:21.443

Also I think a can be defined as the string "|/-\\" without any issue. And since a is only referenced once you don't have to define it at all. – Post Rock Garf Hunter – 2016-12-23T20:53:45.833

1Another thing I noticed is the fourth line is the same as f%=3. – Post Rock Garf Hunter – 2016-12-23T20:55:53.073

While True: is the same as While 1: – Post Rock Garf Hunter – 2016-12-23T20:57:06.190

1

awk, 46 bytes

In awk, with some help from ANSI codes and the rotor comes piped in:

{while(i=1+i%4)print"Loading... "$i"\033[1A"}

Try it:

$ echo \|/-\\|awk -F '' '{while(i=1+i%4)print"Loading... "$i"\033[1A"}'
Loading...[|/-\]

One byte comes off if NF is replaced with 4. I didn't wait to see if i iterates to oblivion.

James Brown

Posted 2016-11-27T20:28:55.133

Reputation: 663

1Does this have the space between the ... and the cycling chars? – FlipTack – 2016-12-28T09:38:21.163

@FlipTack Missed that, I stand corrected. – James Brown – 2016-12-28T11:14:14.197

1

tcl, 83

while 1 {lmap c {| / - \\} {puts -nonewline \rLoading...$c;flush stdout;after 250}}

Can be seen running on: https://goo.gl/BJmxV0

sergiol

Posted 2016-11-27T20:28:55.133

Reputation: 3 055

1

SmileBASIC, 51 46 bytes

CLS?"Loading... ";"|\-/"[3AND MAINCNT/15]EXEC.

12Me21

Posted 2016-11-27T20:28:55.133

Reputation: 6 110

1

Bash, 100 bytes

while [ 1 ]; do for i in `echo '|/-\' | grep -o .`; do printf $'\rLoading...'$i;sleep 0.25;done;done

This is not nicely golfed, so please tell me where I can improve here.


This does work, and has been tested on a Raspbian Raspberry Pi, an Amazon server, and an Ubuntu machine. This would not work on a Solaris machine because the sleep command on those systems cannot take inputs less than 1.

ckjbgames

Posted 2016-11-27T20:28:55.133

Reputation: 1 287

1

C#, 183 180 178 170 161 140 bytes

I know a C# solution has already been posted, but this one is a fully functional console program (including usings) in less bytes!

Golfed

class P{static void Main(){for(int i=0;;){System.Console.Write("\rLoading... "+@"|/-\"[i=i++==3?0:i]);System.Threading.Thread.Sleep(250);}}}

Ungolfed

class P
{
    static void Main()
    {
        for (int i = 0; ;)
        {
            System.Console.Write("Loading... "+@"|/-\"[i = i++ == 3 ? 0 : i]);
            System.Threading.Thread.Sleep(250);
        }
    }
}

Yes, I'm probably very late, but I had to post it..!

EDIT: I figured someone else posted a 109 byte C# solution, oh well
EDIT 2: Thanks to the poster of the 109 byte C# solution, I managed to lose 3 more bytes by removing i<4 from my for loop, thanks!
EDIT 3: Removed C# 6 string interpolation and used good old + instead to save 2 more bytes.
EDIT 4: Not declaring a var for the animation characters anymore, instead I added them directly into the Write() method, saving another 8 bytes
EDIT 5: Removed the parameter string[]s from the Main method to save 9 bytes!
EDIT 6: Used carriage return instead of System.Console.Clear(), removed a using and moved the incrementing of i + the ternary inside of System.Console.Write(), all thanks to @CSharpie! (all this saved 21 bytes)

Metoniem

Posted 2016-11-27T20:28:55.133

Reputation: 387

Instead of Console.Clear just use a carriage return infront of the string. c.Write("\rLoading... "+@"|/-\"[i]);. Then you probably can further reduce by getting rid of the using since you only need System.Console.Write("\rLoading... "+@"|/-\"[i]); You can put your ternary expression in there too, making it System.Console.Write("\rLoading... "+@"|/-\"[i=i++==4?0:i]); whilst also removing the i++ from the for-loop. – CSharpie – 2017-02-01T20:13:21.790

One small mistake, cant edit comments after 5 minutes so: Console.Write("\rLoading... "+ @"|/-\"[i=i++==3?0:i]); resulting in 142 bytes. – CSharpie – 2017-02-01T20:19:56.553

Woah @CSharpie that's some awesome improvements, thanks alot! I'll apply some of them, but I will have to explain why I rolled back the carriage return (I added it earlier): imgur GIF this is happening when the console window isn't wide enough, somehow. Doesn't happen using .Clear()

– Metoniem – 2017-02-02T07:44:48.373

thats nothing you need to worry about. – CSharpie – 2017-02-02T08:04:09.150

@CSharpie Oh, really? I'll apply that as well then! Thank you very much :) I also discovered a weird exception happening using .Clear() but I don't think this is the right place to discuss that, so I posted it on SO instead – Metoniem – 2017-02-02T08:15:04.883

1

SmileBASIC, 57 bytes

@L CLS?"Loading... "+"|/-\"[I]:I=(I+1)MOD 4 WAIT 15 GOTO@L

Ungolfed:

@L                       'loop start
CLS                      'clear console
?"Loading... "+"|/-\"[I] 'construct our output and print
I=(I+1)MOD 4             'inc counter, MOD to prevent overflow
GOTO @L                  'loop

snail_

Posted 2016-11-27T20:28:55.133

Reputation: 1 982

1

PKod , 48 bytes ~ Non-Competing

Possibly the only way I can do this, as PKod only has one write-able variable lL=oo=ao=do=io=no=go=.ooo =|oyw=/oyw=-oyw=\oywl<

Explanation: l - Clear screen and since its the first char, allow printing no operation (NOP) chars
             L - NOP, thus print "L"
             =oo=ao=do=io=no=go=.ooo - Set as certain chars and print them.
             (space) - Another NOP, thus print a space
             =|oyw - Set char as "|", print it, then wait a quarter of a second and remove it
             =/oyw=-oyw=\oywl - Same as above, with different symbols to match the challenge
             < - Go back to the start

"Gif" (more like mp4): https://i.gyazo.com/577dd164313a6b2e5dbf40249efb435d.mp4

You can see quote marks around the code in the console, thats because cmd tries to do stuff with my "<" and would return an error. It's just to nicely pass the code to the interpeter without cmd interfering.

P. Ktinos

Posted 2016-11-27T20:28:55.133

Reputation: 2 742

1

JavaScript (ES6) + HTML, 77 74 bytes

f=c=>setTimeout(f,250,-~c%4,o.value="Loading... "+"|/-\\"[~~c])
<input id=o

Try It

(f=c=>setTimeout(f,250,-~c%4,o.value="Loading... "+"|/-\\"[~~c]))()
<input id=o>

Shaggy

Posted 2016-11-27T20:28:55.133

Reputation: 24 623

1

PHP, 56 bytes

while(!usleep(25e4))echo"\rLoading... ",'\|/-'[@$i++%4];

kip

Posted 2016-11-27T20:28:55.133

Reputation: 141

0

Swift 3, 75 bytes

do{"|/-\\".characters.map{print("\u{001B}[2J\nLoading... \($0)");sleep(1)}}

I need to use \u{001B} (ESCAPE) and [2J (clear screen) here because the old system API is deprecated in Swift 3 and I can't use \r on Mac/Linux. I would lose bytes if I had to use the length posix_spawn call or NSTask. I also hate having to access a string's CharacterView in order to map over each character. At least I saved some bytes by using do instead of a while loop.

JAL

Posted 2016-11-27T20:28:55.133

Reputation: 304

0

ForceLang, 130 bytes

Noncompeting, requires language features (datetime.wait) that postdate the question.

def w io.write
set z string.char 8
def d datetime.wait 250
w "Loading...  "
label 1
w z+"|"
d
w z+"/"
d
w z+"-"
d
w z+"\"
d
goto 1

SuperJedi224

Posted 2016-11-27T20:28:55.133

Reputation: 11 342

0

Rust, 196 bytes

use std::*;
use std::io::Write;
fn main(){let mut i=0;loop{print!("Loading... {}",['|','/','-','\\'][i]);io::stdout().flush();thread::sleep(time::Duration::from_millis(250));i=(i+1)%4;print!("\r")}}

Ungolfed with explanation:

// We have to use the std library before we can use the io, time, and thread modules
use std::*;
// We also have to have the std::io::Write trait in scope before we can use the functions it defines (like flush)
use std::io::Write;
// The main function
fn main() {
  // Our counter. It has to be declared mutable so that we can change it
  let mut i = 0;
  // loop creates an infinite loop 
  loop {
    // print the loading text with the current spinner char
    // ['|','/','-','\'][i] must be used instead of "/-\\"[i] because Rust's strs and Strings don't allow indexing. :(
    print!("Loading... {}", ['|','/','-','\'][i]);
    // Flush stdout. Without this nothing will be displayed on the screen
    io::stdout().flush();
    // Sleep for 250 ms (0.25 secs)
    thread::sleep(time::Duration::from_millis(250));
    // Increment the counter 
    i = (i+1)%4;
    // print a carriage return to clear the line
    print!("\r")
  }
}

BookOwl

Posted 2016-11-27T20:28:55.133

Reputation: 291

https://codegolf.stackexchange.com/a/122770/45877 – Chad Baxter – 2017-05-25T17:12:21.163

0

Windows Batch, 109 bytes

This is just another solution in Windows Batch

@echo off
call:s ^|
call:s /
call:s -
call:s \
%0
:s
cls
echo Loading... %1
ping 1.1 -n 1 -w 250>nul
goto:eof

I'm not quite shure what's wrong with the pipesymbol.

YourDeathIsComing

Posted 2016-11-27T20:28:55.133

Reputation: 71

The pipe is a special character in batch – SuperJedi224 – 2016-12-26T00:22:31.837

0

C# - 111 bytes

Just added some "creative [ac]counting" to existing C# answers.

void G(){for(var i=0;;i=i%4+1){Console.Write("\rLoading... "+"|/-\\|"[i]);System.Threading.Thread.Sleep(250);}}

Human readable version.

void G()
{
    for (var i = 0; ; i = i % 4 + 1)
    {
        Console.Write("\rLoading... " + "|/-\\|"[i]);
        System.Threading.Thread.Sleep(250);
    }
}

Luc

Posted 2016-11-27T20:28:55.133

Reputation: 191

0

Ruby, 57 bytes

Same length as Conor O'Brien's answer, but a different approach:

%w(| / - \\).cycle{|c|$><<"Loading... #{c}\r";sleep 0.25}

daniero

Posted 2016-11-27T20:28:55.133

Reputation: 17 193

0

Scala, 86 bytes

def t(i:Int=0):Any={print("\b"*12+"Loading... "+"|/-\\"(i));Thread sleep 250;t(i+1&3)}

Explanation:

def t(i:Int=0):Any={ //define a method t
  print(               //print...
    "\b"*12+             //a backspace character repeated 12 times to delete everything
    "Loading... "+       //the string "Loading... 
    "|/-\\"(i)           //and the i-th char of the char in question
  );
  Thread sleep 250;    //sleep 250ms
  t(i+1&3)             //call t with i incremented by one, but capped at 3
}

Like most other answers, it looks pretty standard console-like.

corvus_192

Posted 2016-11-27T20:28:55.133

Reputation: 1 889

0

C#, 168 136 123 109 Bytes

Golfed:

void S(){for(int a=0;;a++){Console.Write("\rLoading... "+"|/-\\"[a%=4]);System.Threading.Thread.Sleep(250);}}

Ungolfed:

void S()
{
    for(int a = 0; ; a++)
    {
        Console.Write("\rLoading... " + "|/-\\"[a%=4]);
        System.Threading.Thread.Sleep(250);
    }
}

See it working here:

enter image description here

Edit: Simplified the array.

Edit2: For is way better for this.

GonacFaria

Posted 2016-11-27T20:28:55.133

Reputation: 111

Regarding the edit sugestion: You dont need the Console.Clear(). Check the result gif I put, and when in doubt, test it out first ;) – GonacFaria – 2017-02-01T13:15:59.167

0

tcl, 79

while 1 {lmap c {| / - \\} {puts -nonewline stderr \rLoading...\ $c;after 250}}

assuming I can write to stderr instead of stdout

sergiol

Posted 2016-11-27T20:28:55.133

Reputation: 3 055

0

C, 92 89 82 bytes

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

MD XF

Posted 2016-11-27T20:28:55.133

Reputation: 11 605

0

shortC, 59 bytes

i;f(){O;;i=4)Wi--)dR2,"\rLoading... %c","|\\-/"[i]),U250000

MD XF

Posted 2016-11-27T20:28:55.133

Reputation: 11 605

0

T-SQL, 121 bytes

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

WORNG ALL

Posted 2016-11-27T20:28:55.133

Reputation: 61

0

><>, 68 Bytes, Noncompeting

Unfortunately there's no way to clear output in ><>, so this doesn't follow the challenge specifications exactly.

'/...gnidaoL'c>1-:?\~01g11g21g10g21p11p01p10pao
-\|           \ {o}/

Prints

Loading.../
Loading...-
Loading...\
Loading...|
Loading.../
.
.
.

Explanation:

'/...gnidaoL'

Pushes the ascii values for Loading.../ to the stack

             c>1-:?\~
              \ {o}/

Prints the top value of the stack, 11 times. Removes the counter when done.

 /                   01g11g21g10g21p11p01p10pao
-\|

Rotate the symbols '/ | \ -' in the codebox, and print a new line. So, after the first printing, we go to

'-...
\|/

And then

'\...
|/-

And so on.

Bolce Bussiere

Posted 2016-11-27T20:28:55.133

Reputation: 970

0

C++ (224)

This certainly isn't the shortest code to do this. I like doing coding challenges, so I'm posting it anyway.

#include <iostream>
#include <string>
#include <thread>
using namespace std;int main(){string s = "|/-\\";int i=0;cout<<"Loading... ";while(1){cout<<s[i];this_thread::sleep_for(chrono::milliseconds(99));cout<<"\b";i=++i%4;}}

Colin Robertson

Posted 2016-11-27T20:28:55.133

Reputation: 31

You can save 2 bytes by removing the spaces around =. – Post Rock Garf Hunter – 2018-01-12T17:46:21.930

0

Japt, 38 bytes

@Oq Oo`LoÃHg... `+"|/-\\"gW°%4)1
a#úiU

Try it online!

How it works

@Oq Oo`LoÃHg... `+"|/-\\"gW°%4)1
a#úiU

@               Declare a function...
 Oq               that clears the screen,
 Oo"Loading... "  prints this string,
 +"|/-\\"gW++%4   plus the spinner char (using a variable W),
 )1               and finally returns 1
                and implicitly store this function to U.

a       Call U once (return 1 is needed for this)
 #úiU   and call U every 250 milliseconds.

By the nature of Japt syntax, it's impossible to call U() directly (well, it's possible using JS directive $...$ but it's too long after all.) So we use U.a() method that calls U with numbers from 0 to infinity until U returns true. If you omit )1 at the end of the first line and try running it, your browser will hang.

Without the initial U() call, the output window will show the implicit output (seemingly random integer value) before first showing the Loading... text.

Finally, a#úiU actually translates to U.a(250 .i(U)), which registers the 250ms loop first and then passes the return value (which happens to be undefined) to U.a (which accepts optional function argument, but seems to do nothing special with undefined).

Bubbler

Posted 2016-11-27T20:28:55.133

Reputation: 16 616

0

><> with -t.03 flag, 33 bytes

'o!vooooo|\-/ ...gnidaoL
{[4<o8o:

Try it online!

The only part of the specification this doesn't implement is that the first frame should be printed as soon as the program is run which seems rather strict and unobservable. The first frame here take 1.08 seconds to print, and every frame after that takes 0.24 seconds.

Jo King

Posted 2016-11-27T20:28:55.133

Reputation: 38 234

0

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
?"Loading..."
Do
?@(1,11)Mid$("|/-\\",i+1,1)
Wait.25
i=Mod(i+1,4)
Loop

Taylor Scott

Posted 2016-11-27T20:28:55.133

Reputation: 6 709

Can you use i instead of i+1 in Mid$? – 12Me21 – 2018-05-17T11:55:39.217

@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

– Taylor Scott – 2018-05-17T12:43:24.890

0

Groovy, 59 bytes, 61 bytes

print'Loading...'for(;;)'|/-\\'.each{print"$it\b";sleep250}

asciicast

Matias Bjarland

Posted 2016-11-27T20:28:55.133

Reputation: 420

-1

Rust, 117 Bytes

print!("Loading... ");fn f(){let a="\\|/-";for n in 0 .. 4{std::thread::sleep_ms(250);print!("\x08{}",a[n]);}f();}f;

Fixed some compile errors. Nowhere near a compiler right now so bear with me.

Chad Baxter

Posted 2016-11-27T20:28:55.133

Reputation: 248

When I try to compile it I get the following error message https://gist.github.com/BookOwl/f1ba940ce7c41e9f49158d270631d1ca

– BookOwl – 2017-05-25T18:16:44.197