text:
Count the changes in an array
Your task today is to write a program or function that takes an array of integers, and counts the number of times, reading it left to right, that the value changes. This is easier to show with an example: [1 1 1 2 2 5 5 5 5 17 3] => [1 1 1 **2** 2 **5** 5 5 5 **17** **3**] => 4
Test case:
Input           |   Output
[]              |   0
[0]             |   0
[0 1]           |   1
[0 0]           |   0
[1 2 3 17]      |   3
[1 1 1 2 2 3]   |   2
[-3 3 3 -3 0]   |   3

This is code-golf, fewest bytes wins!

Is my answer valid if the result is always correctly calculated, but if it's 0, False is printed instead?

@FlipTack That depends on the language. In general, if I can say 2+False and it errors, that's not fine, but if I get 2, that's fine.

@FlipTack By default, this is the consensus.

Is empty output for 0 acceptable?

@Titus yes it is.

MATL, 2 bytes
dz

Try it online! Or verify all test cases.
Explanation
     % Implicit input
d    % Consecutive differences
z    % Number of nonzeros
     % Implicit display

Python 3, 38 bytes
f=lambda x=0,*y:y>()and(x!=y[0])+f(*y)

Try it online!

Huh, did know know you could use a default arg like that, nice find.

Easier test case format

@Dennis How does the function exit the recursive loop when the array is empty? I don't see how this doesn't end in a maximum recursion depth exceeded.

@Ioannes Once there's only one element (x) left, y>() will evaluate to False, so the code following and doesn't get executed.

Haskell, 33 bytes
f(a:b:r)=sum[1|a/=b]+f(b:r)
f _=0

Try it online!

Bonus: Somewhat curious point-free arithmetic version (44 bytes)
sum.(tail>>=zipWith((((0^).(0^).abs).).(-)))

Try it online!
Given an input [1,1,4,3,3,3], we first take the difference of adjacent entries ([0,3,-1,0,0]), then the absolute value: [0,3,1,0,0]. Taking zero to the power of each element the first time yields [1,0,0,1,1], and a second time inverts the list: [0,1,1,0,0] ((1-) would also work here instead of (0^)). Finally we take the sum of the list to get 2.

Python 2, 42 bytes
lambda a:sum(x!=y for x,y in zip(a,a[1:]))

Try it online!

Brain-Flak, 50 bytes
([][()]){{}({}[({})]){{}<>({}())(<>)}{}([][()])}<>

Try it online!
Outputs nothing for 0, which in brain-flak is equivalent. If this is not acceptable, than append this for +4 bytes: ({})
Explanation:
#Push stack-height-1
([][()])

#While true:
{

    #Pop the stack-height-1 off
    {}

    #If 'a' is the element on top of the stack, and 'b' is the element underneath it, then
    #Pop 'a' off, and push (a - b)
    ({}[({})])

    #If (a-b) is not 0...
    {
        #Pop (a-b) off
        {}

        #Switch stacks
        <>

        #Increment the value on the other stack
        ({}())

        #Push a 0 back to the main stack
        (<>)

    #Endif
    }

    #Pop either (a-b) or the 0 we pushed
    {}

    #Push stack-height-1
    ([][()])

#Endwhile
}

#Toggle to the alternate stack and display the counter
<>

Different approach, same length

@Riley Nicely done! :)

Slight improvement for 48 bytes

@WheatWizard I tried that also, but it loops forever on empty input. -0+1 = 1

K (oK), 8 bytes
Solution:
+/1_~~':

Try it online!
Examples:
+/1_~~':1 1 1 2 2 5 5 5 5 17 3
4
+/1_~~':()
0
+/1_~~':-3 3 3 -3 0
3

Explanation:
Interpreted right-to-left:
+/1_~~': / the solution
     ~': / equal each-previous
    ~    / not (ie differ)
  1_     / 1 drop, remove first as this is different to null
+/       / sum up trues

Haskell, 35 bytes
-8 bytes thanks to H.PWiz.
Out-golfed by a recursive version. Haskell is pretty much the best at recursion and I missed it. >_<
f l=sum[1|x<-zipWith(/=)l$tail l,x]

Try it online!
It'd be awesome if anybody figured out how to employ this tip.
Alternate solution, 36 bytes
f l=sum[1|True<-zipWith(/=)l$tail l]

Try it online!

Also 35

That tip misses the crucial fact that you'd need to uncurry the function f to get it to work. This sum.map fromEnum.(zipWith(/=)=<<tail) is probably the closest you get, but it won't work with [] and is 37 bytes..

Brain-Flak, 50 bytes
(([][()]){[{}]<({}[({})])>{(<{}>)()}{}([][()])}<>)

Try it online!
# Get ready to push the answer
(

# Push stack height - 1
([][()])

# Loop until 0 (until the stack has a height of 1)
{

  # Pop the old stack height and subtract it
  #(cancels the loop counter from the final answer)
  [{}]

  # Pop the top of the stack and subtract the next element from that
  # Don't include this in the final answer
  <({}[({})])>

  # If not 0
  {

    # Pop the difference between the last two numbers
    # Don't include this in the final answer
    (<{}>)

    # Add 1 to the final answer
    ()

  # End if
  }{}

  # Push stack height - 1
  ([][()])

# End while
}

# Switch to the off stack so we don't print anything extra
<>

# Push the total sum. This is the number of times the if was true
)

Congrats for 10k rep!

@Pavel Thanks! It took me forever to get the last few hundred. I've been too busy with other stuff :(

I had this

@H.PWiz I had that at one point, but I like how the pop cancels the stack height push.

Java (OpenJDK 8), 65 bytes
Not as short as I'd like, but that's just Java for you.
Test by passing the array as a comma delimited list.
a->{int s=0,i=1;for(;i<a.length;s+=a[i-1]!=a[i++]?1:0);return s;}

Try it online!

If the empty array wasn't a test case (and I don't find it really relevant, actually), one could have used: a->{int s=0,p=a[0];for(int n:a)s+=p==(p=n)?0:1;return s;} (57 bytes).

@OlivierGrégoire I know! I wrote that out and thought I'd managed to cut down the bytes but it failed on that first case.

56 bytes: a->{int s=0;for(int i:a)s+=a[0]!=(a[0]=i)?1:0;return s;}

Jelly, 3 bytes
ITL

Try it online!
How it works

ITL  - Full program.

I    - Increments (deltas).
 T   - Get the indices of truthy values (gets the indexes of non-0 elements).
  L  - Length.

Retina, 24 21 16 bytes
Thanks to @MartinEnder for -3 bytes and noticing a bug
-1 byte thanks to @tsh
-4 bytes thanks to @Leo
m`^(\S+)¶(?!\1$)

Try it online!

Wolfram Language (Mathematica), 23 24 26 29 bytes
Length@Split@#~Max~1-1&

Try it online!

-1 byte thanks to Martin Ender!
-2 bytes thanks to JungHwan Min! nice use of Split[].
-3 bytes thanks to totallyhuman!

a little explanation:
Split will divide an array into a list of lists (of same elements), that is, turning {1, 2, 2, 3, 1, 1} into {{1}, {2, 2}, {3}, {1, 1}} . So, Length@Split@# is the quantity of consecutive segements. Max[*****-1, 0] is used to deal with {} input.

26 bytes.

24 bytes: Max[Length@Split@#-1,0]&

23: Length@Split@#~Max~1-1&

Ohm v2, 3 bytes
ΔyΣ

Try it online!
Explanation
Δ     absolute differences between consecutive elements
 y    sign: 1 if positive, -1 if negative, 0 if zero
  Σ   sum

Clever usage of the sign builtin!

@NickClifford Thanks!

Husk, 3 bytes
Ltg

Try it online!
Explanation
Ltg    Input: [1,1,1,2,2,3]
  g    Group equal elements together: [[1,1,1],[2,2],[3]]
 t     Drop the first group (if any): [[2,2],[3]]
L      Return the length of the list: 2

Perl 6, 18 bytes
{sum $_ Z!= .skip}

Test it
Expanded:
{ # bare block lambda with implicit parameter ｢$_｣

  sum         # count the number of True values

      $_      # the input
    Z!=       # zip using &infix:«!=»
      .skip   # the input, but starting from the second value
              # (implicit method call on ｢$_｣
}

Symbolic Python, 120 117 bytes
Golfed 3 bytes by removing an explicit cast to integer (using unary +) for the counter variable - this means that if there are no changes in the array the output will be False instead of 0, but this is allowed by meta.
___=-~(_==_)
__('___=~-'+`_>_`[___::___]+`__`[-~___]+'(_)')
__('__=___=_>_'+';___+=_[__]!=_[-~__];__=-~__'*___)
_=___

Try it online!
# LINE 1: Generate value '2' for utility
___=-~(_==_)

# LINE 2: Get len(input) - 1
__('___=~-'+`_>_`[___::___]+`__`[-~___]+'(_)')
   '___=~-'+`_>_`[___::___]+`__`[-~___]+'(_)'     # Generate string '___=~-len(_)'
            `_>_`[___::___]                       #    'le' spliced from 'False'
                           +`__`[-~___]           #    'n' indexed from '<function ...>'
   '___=~-'+                           +'(_)'     #    Remaining characters in plaintext
__(                                          )    # Execute this to get len(input) - 1

# LINE 3: Main calculation loop
__('__=___=_>_'+';___+=_[__]!=_[-~__];__=-~__'*___)
__(                                               ) # Execute:
   '__=___=_>_'                                     #   Set var1, var2 to 0
               +';                           '*___  #   len(input) - 1 times do:
                       _[__]!=_[-~__]               #   Compare input[var1, var1 + 1]
                  ___+=              ;              #   Add this to var2
                                      __=-~__       #   Increment var1

# LINE 4: Set output variable ('_') to the result calculated.
_=___

=_= what is this wizardry?

Elm, 59 bytes
f x=case x of
 a::b::c->f(b::c)+if a/=b then 1 else 0
 _->0

You can test this out here.  Paste the following code to get started:
import Html exposing (text)

f x=case x of
 a::b::c->f(b::c)+if a/=b then 1 else 0
 _->0

main =
  f [0,0,1,0]
  |> Debug.toString
  |> text

@Steffan Thanks.  That's not the first time I've done that.  Stuck in the Haskell mindset I guess.

Well Haskell allows it too lol

@Steffan You basically never use case in Haskell instead you use pattern matching which requires parenthesis due to the order of operations.

I know, but you still use pattern matching in list comprehensions, where you can omit the parens.

I was just thinking it's too bad you can't do a pattern match like a::a::c. Stuck in the Prolog mindset I guess. ;)

@DLosc You can also do them in Curry, which is much closer to Elm.

PowerShell, 52 45 bytes
(-7 bytes thanks to Julian)
$i=0
$args|%{$i+=$p-ne$_-and$p-ne$n
$p=$_}
$i

Try it online!
Takes input $args, dumps it into a for loop, each iteration checking whether the $previous value is -notequal to the current value $_, and whether the previous value is $null. Exploits the Boolean-to-int implicit converstion to accumulate that into $i. Outputs $i at the end.
The initial $i=0 is needed to account for if the input is empty, and to (properly) account for when the input is a single value.

5 years late :) 45 bytes

Where's the $n come into existence? @Julian

Oh. $null. Derp.

yep, it is not very aesthetic, but I can't think of any cleaner approach

Husk, 4 bytes
#IẊ≠

Try it online!

05AB1E, 3 bytes
¥ĀO

Try it online!

R, 24 bytes
cat(sum(!!diff(scan())))

Try it online!
Same as the MATL answer, just used sum(!!diff)) since there's no nnz.

+1 I thought using rle would be shorter, but nope, length(rle()$v) uses too many characters and is off by one.

@NealFultz it's probably still worth posting as an answer! Always good to see another approach. And you should use sum(rle()$v|1) instead of length anyway. :)

Cubix, 24 bytes
UpO@0I>I!^-u>q.uvv$!^;)p

Try it online
Note that Cubix uses 0 to indicate that there are no more inputs, so 0 cannot be in the list.
Explanation
Unfolded:
    U p
    O @
0 I > I ! ^ - u
> q . u v v $ !
    ^ ;
    ) p

We start at the 0, pushing the counter (initialized with 0) and the first input (I) onto the stack.
We then enter the loop.  At each iteration of the loop, we get the next input with I.  If it's 0, we've run out of inputs, so we rotate the counter to the top (p), Output, and exit (@).
Otherwise, we take the difference of the top two elements.  If it's nonzero, we rotate the counter to the top, increment it, and rotate it back to the bottom with p)q.  We then pop the difference with ; before moving to the next iteration.
All the characters not mentioned here are just control flow.  There tend to be a lot of those in Cubix programs.

@MickyT Good approach, but you seem to be overcounting by 1.  You could swap the 0 for a (, but that fails on the empty input.

apologies, will look at it again

APL (Dyalog), 8 bytes
+/2≠/⊃,⊢

Try it online!
How?
⊃,⊢ - the list, with the first value repeated for the case of single element
2≠/ - changes list, not equal for every 2 elements
+/ - sum

Brain-Flak, 50 bytes
(([][()]){[{}({}[({})])]{{}()(<()>)}{}([][()])}<>)

Try it online!
Since everyone is posting their 50 byte solutions here is mine (I have a 48 byte one but it was a simple modification of DjMcMayhem's so I did feel it worth posting)
Explanation
This answer extensively uses value canceling.
Un-golfed it looks like
([][()])({<{}({}[({})])>{<{}>()(<()>)}{}<([][()])>}<>)

Here we compute the delta's until the stack has one item left, each time we accumulate one value from the inner loop if the delta is non zero.
This is a pretty straight forward way of doing it.
To make this golfy we begin value canceling.  The first one and the one that should be obvious to any hardened brain-flak golfer is the stack heights.  It is a well known fact that
([])({<{}>...<([])>}{})

is the same as
(([]){[{}]...([])}{})

When the values are modified by one, the same holds.  This gives us
(([][()]){[{}]<({}[({})])>{<{}>()(<()>)}{}([][()])}<>)

You may notice this didn't even save us bytes, but don't fret it will become more useful as we go on.
We can perform another reduction,  if you see a statement
<(...)>{<{}> ...

you can actually reduce it to
[(...)]{{} ...

This works because if we enter the loop [(...)] and {} will cancel, and if we don't the value of [(...)] already was zero in the first place and doesn't need to be canceled.  Since we have an occurrence of this pattern in our code we can reduce it.
(([][()]){[{}][({}[({})])]{{}()(<()>)}{}([][()])}<>)

That saved us 2 bytes but it also put two negs next to each other.  These can be combined to save us another 2.
(([][()]){[{}({}[({})])]{{}()(<()>)}{}([][()])}<>)

And that's our code.

Gaia, 2 bytes
ėl

Try it online!
This abuses a bug (or feature?) of Gaia, that run-length-encoding doesn't take the last run of elements into account. Note that I have double checked, it works for all test cases.

ė - Run length encoding (with the flaw described above).
l - Length.

JavaScript (ES6), 35 bytes
a=>a.filter((e,i)=>e-a[i+1]).length

I wonder if it could be shortened by using recursion. But my best attempt is 35 as well: f=([a,...b])=>1/a?!!(a-b[0])+f(b):0

@Arnauld I'd tried that too, but miscounted and thought it was 36 bytes, otherwise I'd have added it in as an alternative.

Pyth, 5 bytes
l #.+

Test suite.
Explanation:
   .+  Deltas
  #    Filter on identity (space)
l      Get length

Perl 5, 37 + 2 (-ap) = 39 bytes
$\+=$F[$_]!=$F[$_-1]for 1..$#F}{$\|=0

Try it online!

34 bytes, based on your answer: Try it online!. 31 bytes, using regex instead: Try it online!

J, 10 bytes
[:+/2~:/\]

Infixes of length 2... are they unequal? 2 ~:/\ ]
Sum the resulting list of 0s and 1s: +/
Try it online!

[:+/0=-/\  ought to work for I think 9 bytes.

Pyth, 4 bytes
ltr8

Test suite
"literate"
The number of changes is equal to the number of runs, ignoring the first run if any. r8 run length encodes the input, t removes the first element if any, and l finds the length of the resulting list.

05AB1E, 3 bytes
γ¦g

Try it online!
An alternative to Erik's answer.

γ¦g  ~ Full program.

γ    ~ Group into runs of equal adjacent elements.
 ¦   ~ Remove the first group (if there are any).
  g  ~ Length.

Ah, missed that that was a case.

Ruby, 31 bytes
->a{a.chunk{|x|x}.drop(1).size}

Try it online!

Instead of .drop(1) you can do [1..-1]

@Cyoce Unfortunately drop returns an Enumerator, not an Array, so that doesn't work.

huh. It returns an Array on my version.

@Cyoce Which version?

I'm on 1.9.3 but why can't you take the size of an Array anyway?

I realized I misspoke above; I meant  chunk returns an Enumerator, which is why you can't call [] on the result and have to use drop instead.

C (gcc 5.4.0), 61 bytes
f(c,v)int*v;{int*p=v,s=0;for(;p<v+c-1;s+=*p++!=*p);return s;}

Try it Online!
f is a function taking the length of the array and a pointer to the first element of the array, and returning the number of changes in the array;
This submission utilizes undefined behavior (*p++!=*p, p is used twice in an expression in which it is changed), which works on my machine (gcc 5.4.0) and on TIO, but may not work on other implementations or versions.
Explanation:
f(c,v)int*v;{ // old-style declaration for v, and implicit-int for c and return value
    int*p=v,s=0; // p is a pointer to the current item, s is the number of changes
    for(;p<v+c-1;s+=*p++!=*p); // for each consecutive pair of integers, if they are different, add one to the number of changes
    return s; // return the number of changes
}

Could you maybe add a link to an online testing environment?

@JonathanFrech Added

J-uby, 37 bytes
:zip%:rotate|~:[]&(0..-2)|:count++:!=

More "readable":
(:zip % :rotate) | (~:[] & (0..-2)) | (:count + +:!=)

Explanation:
:zip%:rotate                        # zip a with itself, rotated by one position. this yields [[a[0], a[1]], [a[1], a[2]], [a[2], a[3]], ...]
           |~:[]&(0..-2)            # discard the last pair, as that's [a[-1], a[0]], not one of our changes
                       |:count++:!= # count the pairs with unequal first and second elements (those are changes)

25 bytes (conversion of @daniero's Ruby answer)
~:each_cons&2|:count++:!=

Explanation
~:each_cons&2            # for every pair [a[i],a[i+1]] in a:
            |:count++:!= # count the number of pairs with unequal first and second elements

Why is this non-competing?

@Pavel Language version post-dates the challenge.

@Cyoce non-competing isn't a thing anymore

Bash, 17 bytes
Packages: Core Utilities, sed
uniq|sed 1d|wc -l

Takes an input array of one element per line.
How does it work?
The input goes to stdin, one array element per line, to uniq. uniq squeezes multiple consecutive identical lines into one, then sed 1d purges the first line, passing the rest to wc. wc -l simply counts the number of lines and outputs the count.

Jq 1.5, 51 bytes
[range(1;length)as$i|select(.[$i]!=.[$i-1])]|length

Expanded
[                              # create an array containing
    range(1;length) as $i      # a copy of the input for
  | select(.[$i]!=.[$i-1])     # each successive element difference
]
| length                       # length of final array

Try it online!

Julia 1.0, 23 bytes
~a=sum([0;diff(a).!=0])

Try it online!

The unary operator ~ is redefined to save bytes.

sum returns an error on an empty (untyped) array, so the array is padded with a 0.

22 bytes using diff

Thanks, amelies! I used your solution and changed this answer to a community wiki.

The last test case is not valid though? 3 is expected instead of 2

ouch true! Then the best I can do is 23 bytes
or 24 if you want to use ≠

Vyxal, 3 bytes
ĠḢL

Try it Online!
Alternatively:
Vyxal, 3 bytes
¯TL

Try it Online!
¯ꜝL would also work.
All of these solutions can be 2 bytes by removing L and adding the l flag.

Rust, 68 bytes
|u:Vec<_>|u.iter().fold((0,0,0),|(u,v,w),&x|(u+w*(v!=x)as i8,x,1)).0

Attempt This Online!
Non-Competing Rust, 63 bytes
This version crashes on 0-length inputs so doesn't technically complete the challenge. I think it's more elegant though.
|u:Vec<_>|u.iter().fold((0,u[0]),|(u,v),&x|(u+(v!=x)as i8,x)).0

Attempt This Online!

Haskell + hgl, 7 bytes
l<tl<gr

Attempt This Online!
Explanation

gr group the list into chunks of equal sized elements
tl drop the first element
l get the length

Alternate versions
8 bytes
cne 0<δ

Reflection
I'm quite happy with this. It's hard to imagine any improvements that could be made here. However while looking for alternative versions I found a few things that might be useful to add:

cn id and cn n should likely be added.  cn id counts the number of True values in a list and cn n counts the number of False values in a list.
pa eq should likely be added.

With both of these there would be another 7 byte solution:
cnn<paq

Thunno, \$4 \log_{256}(96) \approx\$ 3.29 bytes
(This is only for v1.1.1+, ATO is on v1.1.0)
z[wL

Or, for \$5 \log_{256}(96) \approx\$ 4.12 bytes (works on all versions)
zyL1-

Attempt This Online!
Explanations:
        # Implicit input                [1, 1, 1, 2, 2, 3]
z[      # Forward-differences           [0, 0, 1, 0, 1]
  w     # Truthy items only             [1, 1]
   L    # Length                        2
        # Implicit output

        # Implicit input                [1, 1, 1, 2, 2, 3]
zy      # Group by consecutive items    [[1, 1, 1], [2, 2], [3]]
  L1-   # Length - 1                    2
        # Implicit output

><> (Fish), 30 bytes
i0\  ;n$\.13$\
1+>i:0(?/:{=?^$

Try it

Pyth, 8 bytes
ssmndZ.+

Try it online!

Ruby, 36 bytes
->a{a.each_cons(2).count{|x,y|x!=y}}

Try it online!

Didn't know about #each_cons! Well played. Do you mind if I translate this into a J-uby answer?

@Cyoce sure, go ahead

You can find it here

@Cyoce Hey, that's a nice language :) It made me think of an old project of mine. It's basically a bunch of monkey patches on the most common classes used for golfing in Ruby -- String, Array, Enumerable etc. The goal was to make all operators such a +, -, *, / etc, work on any combination of these classes, and it has a few nice convenience methods and higher order functions. I never even bothered pushing it to Github but, looking at it now, it really has a lot going on. I think in combination with J-uby it could become really powerful.

@Cyoce I pushed it to Github if you wanna look at it: https://github.com/daniero/rewb. the interesting parts are in lib/rewb. It even has unit tests to demonstrate how all the stuff works. It think it J-uby/rewb could become a nice combo :D

C# (.NET Core), 94 bytes
using System.Linq;
n=>{int?i=0,a=n.FirstOrDefault();n.ForEach(x=>{i+=x==a?0:1;a=x;});return i;}

Try it online!

Japt, 6 bytes
ä- è¦0

Try it online!

ä- è works for 4 bytes.

Octave, 16 bytes
@(x)nnz(diff(x))

Verify all test cases here!
Quite short, seeing that Octave is a conventional language.
Explanation:
@(x)               % Anonymous function that takes x as input
    nnz(       )   % Count the number of non-zero ...
        diff(x)    % ... differences between elements

PHP, 63 bytes
foreach($_GET as$g){$c+=$g!=$l?isset($l)?1:0:0;$l=$g;}echo$c*1;

pass the sequence as a get query with any indexes, or Try it online!
my attempt, not the shortest, but it's something

Stacked, 26 bytes
[2 infixes 0\[...!=+]fold]

Try it online!
Explanation
[2 infixes 0\[...!=+]fold]
[                        ]   anonymous function; argument = arr
 2 infixes                   generate infixes of length 2
           0\[      ]fold    fold the inside function over the infixes (starting = 0)
                               when iterating, stack looks like: (acc (a0 a1))
              ...              merge (a0 a1) into the stack      (acc a0 a1)
                 !=            check for inequality              (acc a0!=a1)
                   +           add to accumulator                (acc+(a0!=a1))

This gives the number of unequal infixes in the array, equivalent to the given problem.

Common Lisp, 56 bytes
(loop as(x y)on(coerce(read)'list)while y count(/= x y))

Try it online!

Python 3, 31 bytes
f=lambda y:sum(y[1:]-y[:-1]!=0)

Try it online!

Since this seems to only work on numpy arrays I think you are going to need to pay the bytes to import numpy.  (or you should at least add a disclaimer)

@WheatWizard Does that still apply when the question specifically says "an array of integers"?

To be honest I'm really not going off of a hard rule in this case, just kind of my opinion, if you would like a hard rule you should ask about it on the meta.

Ruby, 44 Bytes
->a{a.zip(a.rotate)[0..-2].count{|x,y|x!=y}}

Takes the array, and zips the elements with the array rotated one place. This gives pairs of [a[0],a[1]], [a[1],a[2]], [a[2],a[3]], ...
Then we cut off the last element because that's a[-1],a[0], which we don't need here.
Finally, we count the number of pairs with inequal first and second elements (or spaces in between items of the array which change).

AWK, 35 bytes
{for(i=1;i<NF;)s+=$i!=$++i;$0=s+0}1

Try it online!
This requires at least 1 character as input (the character can be a space).
A version without this restriction but with several more bytes is:
BEGIN{RS=" "}{s+=NR>1&&p!=$1;p=$1}END{print s+0}

Try it online!

GNU sed, 30 23 + 3 = 26 bytes
+3 bytes for -r flag. Output is in unary.
s/(\S+)( \1)*//g
y/ /;/

Try it online!
Technically I could drop the second line and say each space is a unary digit for -7 bytes, but I don't want to push it.

Pyke, 4 bytes
$0-l

Try it here!
$    -   delta(input)
 0-  -  ^.remove(0)
   l - len(^)

PHP, 48 47 bytes
<?foreach($_GET[a]as$a)$n+=$_GET[b]!=$a;echo$n;

Run with arrays a and b as GET parameters.
empty output for 0.

J-uby, 21 bytes
Port of my Ruby answer.
:chunk+I|~:drop&1|:+@

Attempt This Online!

Japt -x, 2 bytes
ä¦

Try it
I'm not sure if this uses features introduced after the other Japt answer, but this is much shorter
ä    # Map each adjacent pair through:
 ¦   #  1 if they are different, 0 otherwise

-x   # Sum the new array and print

Factor, 29 bytes
[ 2 clump [ std 0 > ] count ]

Try it online!
Counts the number of adjacent pairs whose standard deviation is greater than zero.

Swift, 51 bytes
This works for any collection whose element type defines the operator !=, not just arrays of integers.
{zip($0,$0.dropFirst()).filter{$0.0 != $0.1}.count}

The spaces around the != operator are necessary; it parses $0.0!=$0.1 as $0.0! = $0.1.
This can be assigned to a variable or called inline:
print({zip($0,$0.dropFirst()).filter{$0.0 != $0.1}.count}([0, 1, 2]))

let x: ([Int]) -> Int = {zip($0,$0.dropFirst()).filter{$0.0 != $0.1}.count}
print(x([0, 1, 2]))

Try it online!

Vyxal, 3 bytes
¯ꜝL

Try it Online!
¯ꜝL
¯   # delta (consecutive diff)
 ꜝ  # non-zero
  L # length

https://codegolf.stackexchange.com/a/252885/78850 already has this answer as a note at the end

@lyxal dammit crap, do I delete then :((

Duplicate answers are allowed

Desmos, 27 bytes
f(l)=sgn(l[2...]-l)^2.total

TIL sgn exists. I've been using sign the entire time... -_-
Try It On Desmos!
Try It On Desmos! - Prettified

Pip, 10 bytes
_MS_!=BMPg

Attempt This Online!
Explanation
_MS_!=BMPg
         g  ; List of command-line arguments
       MP   ; Map this function to each pair of consecutive elements:
   _!=B     ;   1 if elements are not equal, 0 if equal
 MS         ; Map this function over that list and sum the results:
_           ;   Identity function

Thunno 2 S, 2 bytes
Ṣɓ

Attempt This Online!
Explanation
Ṣɓ  # Implicit input
Ṣ   # Forward-differences
 ɓ  # Boolify
    # Sum the list
    # Implicit output

BQN, 10 bytes
+´1⊸↓≠¯1⊸↓

Anonymous tacit function. Try it at BQN online!
Explanation
+´1⊸↓≠¯1⊸↓
  1⊸↓       Drop the first element from the argument list
      ¯1⊸↓  Drop the last element from the argument list
     ≠      Compare those two lists element-wise: 1 if not equal, 0 if equal
+´          Sum the resulting list of 0s and 1s


text:
Approximate My Squares
Inspired by this video by tecmath.
An approximation of the square root of any number x can be found by taking the integer square root s (i.e. the largest integer such that s * s ≤ x) and then calculating s + (x - s^2) / (2 * s). Let us call this approximation S(x). (Note: this is equivalent to applying one step of the Newton-Raphson method).
Though this does have quirk, where S(n^2 - 1) will always be √(n^2), but generally it will be very accurate. In some larger cases, this can have a >99.99% accuracy.
Input and Output
You will take one number in any convienent format.
Examples
Format: Input -> Output
2 -> 1.50
5 -> 2.25
15 -> 4.00
19 -> 4.37               // actually 4.37       + 1/200
27 -> 5.20
39 -> 6.25
47 -> 6.91               // actually 6.91       + 1/300
57 -> 7.57               // actually 7.57       + 1/700
2612 -> 51.10            // actually 51.10      + 2/255
643545345 -> 25368.19    // actually 25,368.19  + 250,000,000/45,113,102,859
35235234236 -> 187710.50 // actually 187,710.50 + 500,000,000/77,374,278,481

Specifications

Your output must be rounded to at least the nearest hundredth (ie. if the answer is 47.2851, you may output 47.29)
Your output does not have to have following zeros and a decimal point if the answer is a whole number (ie. 125.00 can be outputted as 125 and 125.0, too)
You do not have to support any numbers below 1.
You do not have to support non-integer inputs. (ie. 1.52 etc...)

Rules
Standard Loopholes are forbidden.
This is a code-golf, so shortest answer in bytes wins.

Sandbox

Note: s + (x - s^2) / (2 * s) == (x + s^2) / (2 * s)

My solutions: Pyth, 25 bytes; 14 bytes

Does it need to be accurate to at least 2 digits?

@totallyhuman Yes. 47.2851 can be represented as 47.28, but no more inaccurate.

@totallyhuman 47.2851 can also be represented as 47.27. But it cannot be 47.26, as that is flooring and then removing 1/100

Shorter note: s + (x - s^2) / (2 * s) == (x / s + s) / 2, if you take x as a floating point value instead of integer.

@OlivierGrégoire You are allowed to do that.

@downvoter Another case of a downvote & go... what’s wrong? Can I improve this question?

Sorry - looking at this I just realised I was the downvoter, but I don't remember downvoting it (apparently 2 days ago - must've clicked the wrong button). I made a trivial edit and upvoted, sorry about that! :D

Jelly,  8  7 bytes
-1 byte thanks to Olivier Grégoire's simplified mathematical formula - see their Java answer.
÷Æ½+Æ½H

Try it online!
How?
÷Æ½+Æ½H - Link: number, n
 Æ½     - integer square root of n  -> s
÷       - divide                    -> n / s
    Æ½  - integer square root of n  -> s
   +    - add                       -> n / s + s
      H - halve                     -> (n / s + s) / 2

7 bytes: ÷Æ½+Æ½H First time trying to use Jelly so I might be wrong. I wish I knew how to store Æ½, though, to not repeat it. That might save another byte.

Thanks @OlivierGrégoire! Æ½ɓ÷⁹+H would not recalculate the integer root, but it's also 7. ɓ starts a new dyadic chain with swapped arguments and then ⁹ refers to that chain's right argument (i.e. the result of Æ½). Æ½ɓ÷+⁹H would work here too.

Python 2, 47 ... 36 bytes
-3 bytes thanks to @JungHwanMin
-1 byte thanks to @HyperNeutrino
-2 bytes thanks to @JonathanFrech
-3 bytes thanks to @OlivierGrégoire
def f(x):s=int(x**.5);print(x/s+s)/2

Try it online!

-2 bytes: s+(x-s*s)/s/2 to (x+s*s)/s/2

-2 bytes using a function

@HyperNeutrino I only get -1 byte

Oh sorry I accidentally deleted a character after testing and then counted the bytes after :P yeah just -1

Can you not omit +.0 and replace /s/2 with /2./s, saving two bytes?

36 bytes

36 bytes as well, using a lambda instead.

R, 43 bytes 29 bytes
x=scan()
(x/(s=x^.5%/%1)+s)/2

Thanks to @Giuseppe for the new equation and help in golfing of 12 bytes with the integer division solution. By swapping out the function call for scan, I golfed another couple bytes.
Try it online!

35 bytes; more generally, you can use the "header" field of TIO and put a f <-  to assign the function. But still, nice solution, make sure you read Tips for golfing in R when you get a chance!

31 bytes using Oliver Gregoire's formula

Java (OpenJDK 8), 32 bytes
n->(n/(n=(int)Math.sqrt(n))+n)/2

Try it online!
Explanations
The code is equivalent to this:
double approx_sqrt(double x) {
  double s = (int)Math.sqrt(x);  // assign the root integer to s
  return (x / s + s) / 2
}

The maths behind:
s + (x - s²) / (2 * s)  =  (2 * s² + x - s²) / (2 * s)
                        =  (x + s²) / (2 * s)
                        =  (x + s²) / s / 2
                        =  ((x + s²) / s) / 2
                        =  (x / s + s² / s) / 2
                        =  (x / s + s) / 2

This doesn't appear to handle the specification: Your output must be rounded to at least the nearest hundredth

Well, it is rounded to lower than the nearest hundredth, so it's totally valid.

Ah, I see, my misunderstanding.

Haskell, 34 bytes
f x=last[s+x/s|s<-[1..x],s*s<=x]/2

Try it online!
Explanation in imperative pseudocode:
results=[]
foreach s in [1..x]:
 if s*s<=x:
  results.append(s+x/s)
return results[end]/2

APL (Dyalog), 20 16 bytes
{.5×s+⍵÷s←⌊⍵*.5}

Try it online!

MATL, 12 9 bytes
X^kGy/+2/

Try it online!

C, 34 bytes
Thanks to @Olivier Grégoire!
s;
#define f(x)(x/(s=sqrt(x))+s)/2

Works only with float inputs.
Try it online!
C,  41   39  37 bytes
s;
#define f(x).5/(s=sqrt(x))*(x+s*s)

Try it online!
C,  49   47   45  43 bytes
s;float f(x){return.5/(s=sqrt(x))*(x+s*s);}

Try it online!

Thanks to @JungHwan Min for saving two bytes!

47 bytes; edit: Thank you, but credit @JungHwanMin for finding that.

34 bytes

JavaScript (ES7), 22 bytes
x=>(s=x**.5|0)/2+x/s/2

We don't really need an intermediate variable, so this can actually be rewritten as:
x=>x/(x=x**.5|0)/2+x/2

Test cases

let f =

x=>x/(x=x**.5|0)/2+x/2

console.log(f(2))           // 1.50
console.log(f(5))           // 2.25
console.log(f(15))          // 4.00
console.log(f(19))          // 4.37
console.log(f(27))          // 5.20
console.log(f(39))          // 6.25
console.log(f(47))          // 6.91
console.log(f(57))          // 7.57
console.log(f(2612))        // 51.10
console.log(f(643545345))   // 25368.19
console.log(f(35235234236)) // 187710.50

Haskell, 40 bytes
Another one bytes the dust thanks to H.PWiz.
f n|s<-realToFrac$floor$sqrt n=s/2+n/s/2

Try it online!

AWK, 47 44 38 bytes
{s=int($1^.5);printf"%.2f",$1/2/s+s/2}

Try it online!
NOTE: The TIO like has 2 extra bytes for \n to make the output prettier. :)
It feels like cheating a bit to use sqrt to find the square root, so here is a version with a few more bytes that doesn't.
{for(;++s*s<=$1;);s--;printf("%.3f\n",s+($1-s*s)/(2*s))}

Try it online!

well you could say this is AWKward. I’ll show myself out. edit: originally I planned for the question to shun using sqrt, but there’s too many answers and I’ll get tort if I change it so my original idea works.

'AWK' puns are fun :)

instead of sqrt($1) you can use $1^.5

Thanks @Cabbie407 don't know why I didn't think of that.

You're welcome. Some other things: you don't need the \n to get the output, the printf in awk doesn't need parentheses and the formula can be shortened to s/2+$1/s/2, which results in {s=int($1^.5);printf"%.2f",s/2+$1/s/2}. Sorry if this comment seems rude.

The comment is fine. I knew about printf but had been using sprintf recently which does require the parentheses.  I didn't think about simplifying the expression. I like the "\n" for the multiple inputs, but you're right, 2 bytes is 2 bytes.

Vyxal, 8 bytes
:√I:‟/+½

Try it Online!
For n=2
:        # Dup -> [2,2]
√        # Square root -> [2,√2]
I        # Round -> [2,1]
:        # Dup -> [2,1,1]
‟        # Rotate stack right -> [1,2,1]
/        # Divide -> [1,2]
+        # Add -> 3
½        # Halve -> 1.5

05AB1E, 9 bytes
DtïD.Á/+;

Try it online!
Port of my Vyxal answer

Racket, 92 bytes
Thanks to @JungHwan Min for the tip in the comment section
(λ(x)(let([s(integer-sqrt x)])(~r(exact->inexact(/(+ x(* s s))(* 2 s)))#:precision'(= 2))))

Try it online!
Ungolfed
(define(fun x)
  (let ([square (integer-sqrt x)])
    (~r (exact->inexact (/ (+ x (* square square)) (* 2 square)))
        #:precision'(= 2))))

PowerShell, 54 bytes
param($x)($x+($s=(1..$x|?{$_*$_-le$x})[-1])*$s)/(2*$s)

Try it online! or Verify some test cases
Takes input $x and then does exactly what is requested. The |? part finds the maximal integer that, when squared, is -less-than-or-equal to the input $x, then we perform the required calculations. Output is implicit.

Wow. I've never been able to comprehend how people golf in Windows Powershell

@StanStrum You're not alone, lol. :D

Milky Way, 17 14 bytes
-3 bytes by using Olivier Grégoire's formula
^^':2;g:>/+2/!

Try it online!
Explanation
code              explanation                   stack layout

^^                clear preinitialized stack    []
  ':              push input and duplicate it   [input, input]
    2;            push 2 and swap ToS and SoS   [input, 2, input]
      g           nth root                      [input, s=floor(sqrt(input))]
       :          duplicate ToS                 [input, s, s]
        >         rotate stack right            [s, input, s]
         /        divide                        [s, input/s]
          +       add                           [s+input/s]
           2/     divide by 2                   [(s+input/s)/2]
             !    output                        => (s+input/s)/2

shouldn't that be floor instead of ceil?

@mudkip201 Updated, thanks

Husk, 9 bytes
½Ṡ§+K/(⌊√

Try it online!
There is still something ugly in this answer, but I can't seem to find a shorter solution.
Explanation
I'm implementing one step of Newton's algorithm (which is indeed equivalent to the one proposed in this question)
½Ṡ§+K/(⌊√
  §+K/       A function which takes two numbers s and x, and returns s+x/s
 Ṡ           Call this function with the input as second argument and
      (⌊√    the floor of the square-root of the input as first argument
½            Halve the final result

I think you want actual division, rather than ÷

@H.PWiz whoops, I do, thank you. That was a remain from an experiment to find other solutions

Pyt, 11 10 bytes
←Đ√⌊Đ↔⇹/+₂

Explanation
code                explanation                        stack
←                   get input                          [input]
 Đ                  duplicate ToS                      [input,input]
  √⌊                calculate s                        [input,s]
    Đ               duplicate ToS                      [input,s,s]
     ↔              reverse stack                      [s,s,input]
      ⇹             swap ToS and SoS                   [s,input,s]
       /            divide                             [s,input/s]
        +           add                                [s+input/s]
         ₂          halve                              [(s+input/s)/2]
                    implicit print

Just saw this and it was a good minute until I realised it’s not Pyth. Great answer.

Yeah, it's a little language I've been thinking about for a while and just decided to actually make.

Is ToS top-of-stack... and if so, what’s SoS?

ToS is top of stack, and SoS is second on stack

Nice, I’ll see if I can delve into this language; I like it!

I'll start writing some documentation for it - I mean, I have my notes, but they're a mess :P

That’s a lot of elifs, consider using switch/case?

When I get around to rewriting it, sure. But that may be a little while, as I'm still playing around with functionalities.

@Stan Strum: Sadly, that is not an option in Python.

https://docs.python.org/3/faq/design.html#why-isn-t-there-a-switch-or-case-statement-in-python

I realized that shortly after I made my last comment.

C# (.NET Core), 39 bytes
v=>(v/(v=(int)System.Math.Sqrt(v))+v)/2

Try it online!
A C# version of Olivier Grégoire's Java answer.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Confirm the Illuminati
The Illuminati commands you (with their mind control) to output the following string:
         ^
        /_\
       /_|_\
      /_|_|_\
     /_|/o\|_\
    /_|_\_/_|_\
   /_|_|_|_|_|_\
  /_|_|_|_|_|_|_\
 /_|_|_|_|_|_|_|_\
/_|_|_|_|_|_|_|_|_\

Rules:

Trailing spaces are allowed for each line.
Leading spaces in each line are required.
Trailing whitespace is allowed after the full required output.
Since this is a code-golf challenge, the winner shall be the shortest program in bytes.
Since this is a kolmogorov-complexity challenge, hardcoded output is allowed.
Standard Loopholes apply.
Update: You may use tabs instead of spaces, with each tab counting as 4 spaces. If you want for some reason.

Sandbox (I would leave it for the full 72 hours recommended by the sandbox FAQ, but with 7 upvotes and next to no negative feedback, 38 should be fine)

just a small note, you should read this meta question/answer

What's with all the downvotes? I get that some people dislike [tag:kolmogorov-complex] but is this a valid reason to downvote?

@BruceForte probably that I had my own answer to start.

@BruceForte personal opinion is a valid reason, tbh; though IMO it's absolutely rude against a newer user.

I think this is a very nice ascii art challenge. The eye and pyramid point among the pattern take creativity to handle cleanly.

May I use tabs?

Actually, a tab character is one byte ... and offsets to a vertical position divisible by 8 ... or not?

@Titus depends on the font I guess. Here it's 4. I guess it might help for hardcoding.

Charcoal, 25 21 bytes
Ｇ¬χ|_¶_|↗⁹↙^Ｍ³↓/o¶\‖Ｂ

Try it online! Link is to verbose version of code. Explanation:
  χ                     With sides of length 10
 ¬                      In the directions down and left
Ｇ                       Draw a closed polygon (implicit side)
   |_¶_|                Filled with |_ and _| on alternate lines
        ↗⁹               Draw a line of 9 /s
          ↙^            Draw a ^ and move the cursor down and left
            Ｍ³↓         Move down 3 characters
               /o¶\     Print the left half of the eye
                   ‖Ｂ  Reflect the canvas keeping the right edge

There it is! Was wondering how long it would be.

@StephenLeppik I was on the phone :-(

Wait, is that the only reason?

@StephenLeppik: well, that and depending how long before I noticed the notification for a new main post, I guess.

@DLosc < is one of the multidirectionals - when used with the Multiprint command it causes the string to be printed twice, once up right and once down right, but it can also be used as a shortcut for ↗↘ in other contexts too.

Vim, 40 bytes
-2 bytes thanks to DJMcMayhem
9i_|␛r\I/␛qqYPxR /␛q8@qr^4jhR/o\␛jr/2hr\

You can see it in action in this GIF made using Lynn's python script

SOGL V0.12, 31 27 25 bytes
 ^9∫Ƨ_|m└Κ}¹±§"/o¶\_”95žΓ

Try it Here!
 ^                         push "^"
  9∫      }                do 9 times, pushing counter
    Ƨ_|                      push "_|"
       m                     mold that to the counter
        └Κ                   prepend "/"
           ¹               collect the lines in an array - ["^", "/_", "/_|", ..., "/_|_|_|_|_"]
            ±              reverse each                    ["^", "_/", "|_/", ..., "_|_|_|_|_/"]
             §             reverse as ascii-art:
                            ["         ^",
                             "        /_",
                             "       /_|",
                             ...,
                             "/_|_|_|_|_"]
              "/o¶\_”      push "/o
                                 \_"
                     95ž   insert that at [9; 5]
                        Γ  palindromize horizontally

or a 24 byte version using ¼ (space to an antidiagonal) instead of ±§:
 ^9∫Ƨ_|m└Κ}¹¼"/o¶\_”95žΓ

Try it Here!

V, 37 bytes
9i|_á\|r/òÄó_|
>òC ^4jhR/o\j2hR\_/

Try it online!
Hexdump:
00000000: 3969 7c5f 1be1 5c7c 722f f2c4 f35f 7c0a  9i|_..\|r/..._|.
00000010: 3ef2 4320 5e1b 346a 6852 2f6f 5c1b 6a32  >.C ^.4jhR/o\.j2
00000020: 6852 5c5f 2f                             hR\_/

Explanation:
9i                              " Insert 9 copies of...
  |_                            "   '|_'
    <esc>                       " Return to normal mode
         á\                     " Append a backslash
           |                    " Move to the first character
            r/                  " Replace it with a forward slash
              ò                 " Recursively...
               Ä                "   Duplicate this line (upwards)
                ó               "   Remove one instance of..
                 _|             "     '_|'
>                               "   Indent this line with one space
 ò                              " End the loop
  C ^                           " Change this line (previously '/_\') to ' ^'
     <esc>                      " Return to normal mode
          4j                    " Move down 4 lines
            h                   " Move one character to the left
             R                  " Write this text over existing characters...
              /o\               "   '/o\'
                 <esc>          " Return to normal mode
                      j         " Move down a line
                       2h       " Move two characters to the left
                         R      " Write this text over existing characters...
                          \_/   " '\_/'

Python 2, 103 101 98 95 bytes
-2 bytes thanks to Jonathan Frech
-3 bytes thanks to ovs

for i in range(10):print(9-i)*' '+['^','/_%s\\'%['|_'*~-i,'|/o\|_','|_\_/_|_'][i%6/4*i%3]][i>0]

Try it online!

JavaScript (ES6), 95 92 bytes
f=(n=9,s='')=>n--?f(n,s+' ')+s+`/${n-4?n-3?'_|'.repeat(n):'_|/o\\|':'_|_\\_/_|'}_\\
`:s+`^
`

Or 91 bytes with a leading new-line -- which I think is not allowed:
f=(n=9,s=`
`)=>n--?f(n,s+' ')+s+`/${n-4?n-3?'_|'.repeat(n):'_|/o\\|':'_|_\\_/_|'}_\\`:s+`^`

Demo

f=(n=9,s='')=>n--?f(n,s+' ')+s+`/${n-4?n-3?'_|'.repeat(n):'_|/o\\|':'_|_\\_/_|'}_\\
`:s+`^
`

O.innerText = f()

Formatted and commented
f = (n = 9, s = '') =>    // n = line counter, s = leading spaces
  n-- ?                   // if we haven't reached the top:
    f(n, s + ' ') +       //   do a recursive call with one more leading space
    s +                   //   append the leading spaces
    `/${                  //   append the left border
      n - 4 ?             //   if this is not the 4th row:
        n - 3 ?           //     if this is not the 3rd row:
          '_|'.repeat(n)  //       append the brick pattern
        :                 //     else (3rd row):
          '_|/o\\|'       //       append the top of the eye
      :                   //   else (4th row):
        '_|_\\_/_|'       //     append the bottom of the eye
    }_\\\n`               //   append the right border + line-feed
  :                       // else:
    s + `^\n`             //   append the top of the pyramid and stop the recursion

Leading whitespace is allowed.

C (gcc), 124 122 120 119 117 115 118 bytes
-1 byte thanks to @xanoetux
+3 missing the lowest level...
f(i){for(printf("%*c",i=10,94);--i;printf("\n%*c%s_\\",i,47,i^6?i^5?"_|_|_|_|_|_|_|_|_|"+i*2:"_|_\\_/_|":"_|/o\\|"));}

Try it online!

PowerShell, 109 105 bytes
filter f{' '*$_+'/'+'_|'*(8-$_)+'_\'}
' '*9+'^'
8|f
7|f
6|f
'     /_|/o\|_\
    /_|_\_/_|_\'
3..0|%{$_|f}

Try it online!
Saved 4 bytes thanks to Veskah.

Haskell, 110 107 bytes
"         ^\n"++do z<-[1..9];([z..8]>>" ")++'/':g z++"_\\\n"
g 4="_|/o\\|"
g 5="_|_\\_/_|"
g x=[2..x]>>"_|"

Try it online!
Those 9 space at the beginning hurt.
How it works
"         ^\n"++         -- first line, followed by
do                       -- we use the "do" syntatic sugar for monads,
                         -- here the list monad
   z<-[1..9]             -- for all 'z' from [1..9] perform the following
                         -- and collect the results in a single list
     ([z..8]>>" ")++'/'  --   make the spaces for the current line and
                         --   the left wall '/'
     g z                 --   call g to make the inner part
     "_\\\n"             --   append '_', '\' and a NL

g 4="_|/o\\|"            -- line 4 and 5 are implemented directly
g 5="_|_\\_/_|"
g x=[2..x]>>"_|"         -- all other lines are some copies of "_|"

Edit: -3 bytes thanks to @Laikoni:

05AB1E, 47 42 40 bytes
'/„_|ûûû«η'^0ǝ.∞.C":;<IJK"Çv"/o\\_/"Nèyǝ

Try it online!
'/„_|ûûû«                                # Push bottom left tier of pyramid.
         η                               # All prefixes of...
          '^0ǝ                           # Replace the tip.
              .∞.C                       # Mirror, Center.
                  ":;<IJK"Ç              # Push [58,59,60,73,74,75].
                           v"/o\\_/"Nèyǝ # Replace those indexes with the eye.

Stupid version: „_|3×"_|/o\|".;„_|2×û"_|_\_/_".;

Other, less stupid version (but still worse):
05AB1E, 42 bytes
•~µÎт•η4¾ǝ•Σ}•4ǝ•3x1•5ǝεS"|_/\^o"sèJ}€.∞.C

Try it online!

Your alternative is invalid in the latest version of 05AB1E (legacy).

Excel VBA, 104 Bytes
Anonymous VBE immediate window function that confirms the truth.
Version A:
?Spc(9)"^":For i=0To 8:[A1]=i:?Spc(8-i)"/_"[If(A1=3,"|/o\|_",If(A1=4,"|_\_/_|_",Rept("|_",A1)))]"\":Next

Version B:
?Spc(9)"^":For i=0To 8:[A1]=i:?Spc(8-i)"/_"IIf(i=3,"|/o\|_",IIf(i=4,"|_\_/_|_",[Rept("|_",A1)]))"\":Next

Python 2, 154 bytes
l=bytearray
a,b=' _';g=[l(a*9+"^"+a*9)]+[l(a*(8-k)+"/%s\\"%"|".join(b*k+b))for k in range(9)]
g[4][8:11]=l("/o\\")
g[5][8:11]=l("\\_/")
for r in g:print r

Try it online!
-3 bytes using bytearray thanks to Rod
-1 byte thanks to bobrobbob

Bubblegum, 48 bytes
00000000: 5380 8138 2e18 4b3f 3e86 0bce ac01 72e0  S..8..K?>.....r.
00000010: 6c30 0fc6 d1cf 8f01 71e1 cae2 218a e12a  l0......q...!..*
00000020: 6ba0 ea61 7c84 085c 0021 0417 4188 0100  k..a|..\.!..A...

Try it online!

PHP, 123+3 bytes
+3 bytes for the weird tab counting. (it still moves the cursor 8 spaces in any console!)
for($i=10;--$i;)$r.=str_pad(str_pad("
",$i)."/",20-$i,"_|")."\\";$r[48]=$r[65]="/";$r[50]=$r[63]="\\";$r[49]=o;echo"   ^$r";

Note: The first character after echo" is a tab character!
Run with -nr or try it online.
other version, same length:
for(;$i++<9;)$r.=str_pad(str_pad("
",10-$i)."/",10+$i,"_|")."\\";$r[48]=$r[65]="/";$r[50]=$r[63]="\\";$r[49]=o;echo"    ^$r";

What about Eclipse? I haven't used it in a while but I remember that its tabs were 4 spaces.

@StephenLeppik Eclipse is an editor, not a shell.

It still has a console. Not to mention that the SE markdown editor and  tag font both have 4-space tabs

Retina, 79 73 bytes

/8x
8
$*
+`^(.*)\Sx
 $1x¶$&
 x
 ^
/111x
/1/o\|x
/1111x
/1x_/1x
1
_|
x
_\

Try it online!

Ruby, 92 bytes
10.times{|i|s=' '*(10-i)+(i<1??^:"/#{"_|"*~-i}_\\");i/2==2&&s[9,3]="/o\\_/"[i%2*2,3];puts s}

Julia, 152 141 139 130 127 120 113 112 bytes
q="_|";a+b=" "^a*b;a\b=replace(a,q^3,q*b,1);~n=n<0?9+"^\n":~(n-1)*(8-n+"/$(q^n)_\\\n");print(~8\"/o\\|"\"_\\_/")

Explained:
#Define constant q to abbreviate this string
q="_|";

#Redefine the addition operator to compactly provide whitespace
#where needed
a+b=" "^a*b;

#Redefine the inverse division operator so we can substitute
#"_|_|_|" with "_|"*b very compactly
a\b=replace(a,q^3,q*b,1);

#Redefine the bitwise not operator to generate pyramid layers
#Defines them recursively, calling itself to generate previous
#layers before appending its own.
#The base case generates the tip.
~n=n<0?9+"^\n":~(n-1)*(8-n+"/$(q^n)_\\\n");

#Print to output
print(

    #Pyramid with 8 body layers
    ~8

    #Then patch in the eye
    \"/o\\|"
    \"_\\_/"
)

Java 8, 156 bytes
v->"".format("%1$9s^\n%1$8s/a%1$7s/ba%1$6s/bba     /b/o\\|a    /b_\\_/ba   /bbbbba  /bbbbbba /bbbbbbba/bbbbbbbba","").replace("a","_\\\n").replace("b","_|")

Explanation:
Try it here.
v->                        // Method with empty unused parameter and String return-type
  "".format(               //  Format the following String (`%1$Ns` = N spaces)
      "%1$9s^\n            //            ^
       %1$8s/a             //           /_\
       %1$7s/ba            //          /_|_\
       %1$6s/bba           //         /_|_|_\
            /b/o\\|a       //        /_|/o\|_\
           /b_\\_/ba       //       /_|_\_/_|_\
          /bbbbba          //      /_|_|_|_|_|_\
         /bbbbbba          //     /_|_|_|_|_|_|_\
        /bbbbbbba          //    /_|_|_|_|_|_|_|_\
       /bbbbbbbba","")     //   /_|_|_|_|_|_|_|_|_\
    .replace("a","_\\\n")  //  Replace all "a" with "_\" + new-line
    .replace("b","_|")     //  Replace all "b" with "_|"
                           // End of method (implicit / single-line return-statement)

For reference, hard-coded is 179 bytes.

Javascript 90 bytes (if default parameter a=9 is required then 92 bytes)

A=(a,x=``)=>a?A(a-1,x+" ")+x+"/".padEnd(a*2,a^5?a^4?"_|":"_|/o\\|":"_|_\\_/")+`\\
`:x+`^
`
console.log(A(9))

All extraneous arguments must be included in the byte total so this counts as 91 bytes

C# (.NET Core), 174 153 bytes
()=>string.Format(@"{1,10}
{0,10}\
{0,9}{2}{3,10}{2}{0,7}|/o\{2}{3,8}\_/_{2}{0,5}{4}  {3}{4} {3}|_{4}{3}|_|_{4}","/_","^",@"|_\
","/_|_",@"|_|_|_|_|_\
")

Try it online!
An inefficient way of building the pyramid, but interesting working through it.
Acknowledgements
-21 bytes thanks to @someone

C# (.NET Core), 144 bytes
This one may seem quite boring, because it is quite boring.

()=>@"         ^
        /_\
       /z\
      /z|_\
     /_|/o\|_\
    /z\_/z\
   /z|z|z\
  /z|z|z|_\
 /z|z|z|z\
/z|z|z|z|_\".Replace("z","_|_")

Try it online!

Splinter, 124 bytes
H{\/}G{BB}F{\_DG}E{\ H}D{\\\
}C{A\|}B{\ \ }A{\_\|\_}GG\ \^\
GGHFBEADGBHCFE\_\|H\o\\\|FHA\\\_HADBECCADBHCCC\_DECCCADHCCCC\_\\

Try it online!

JavaScript, 117 bytes
I know for a fact I'm not beating any of the golfing languages, but at least I can give my own solution.
$=>[...Array(10)].map((e,i)=>' '.repeat(9-i)+(i--?`/${['_|/o\\|','_|_\\_/_|'][i-3]||'_|'.repeat(i)}_\\`:'^')).join`
`

Here's a demo:

var f = $=>[...Array(10)].map((e,i)=>' '.repeat(9-i)+(i--?`/${['_|/o\\|','_|_\\_/_|'][i-3]||'_|'.repeat(i)}_\\`:'^')).join`
`;
console.log(f());
console.log(f.toString().length);

Explanation:
$=>                                       // outer function start
[...Array(10)]                            // create an array to map
.map(…)                                   // map it
    (e,i)=>                               // mapping function start
    ' '.repeat(9-i)                       // spaces for padding
    +(i--?…:'^')                          // use the carat if at the top of the pyramid
        `/${…}_\\`                        // otherwise, make the sides + steps
            ['_|/o\\|','_|_\\_/_|'][i-3]  // use the patterns for the eye, if in the correct rows
            ||'_|'.repeat(i)              // otherwise, make the "bricks" structure
.join`
`                                         // join all the rows into a string (yes this part has a newline in it)

It's not recommended to answer straight away, let people make their own solutions.

Javascript, 238 bytes
My very first try at codegolfing :D

var f=()=>{let b=x=>' '.repeat(x),g='\\',h='/',i=1,st=[(b(9)+'^').split('')];for(;i<10;i++)st.push((b(9-i)+h+st.map(i=>'_').join('|')+g).split(''));st[4][8]=st[5][10]=h;st[4][9]='o';st[5][8]=st[4][10]=g;return st.map(s=>s.join('')).join('\n');}

document.getElementById("display").innerHTML = f();
console.log(f.toString().length);

Welcome to the site!

Hardcoding is definitely shorter than what you have here. You can shorten this with a few ES6 features: function`s`  instead of function('s'), a=> instead of ()=>, fill(x) instead of map(e=>x), [...s] instead of s.split(''), move a statement into the for initialization, etc.

Much shorter; even just without compression of any kind, it's 163 bytes.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Hello World in Multiple Languages
Task
Create a program or a function that is valid in multiple programming languages, and when compiled/interpreted as a different language outputs "Hello, World!" in a different natural language.
For example, a valid solution might output Hello World! (English) when compiled and run as C, Hallo Welt! (German) when compiled and run as C++ and 你好世界！ (Chinese) when run as Python.
Rules
To avoid ambiguity about the validity of an answer, below is a list of allowed versions of the phrase in several languages. The list consists of the phrase in languages for which Google Translate has a community-verified translation of the phrase (as of this writing).*
The accuracy of these translations is debatable, but they are what this challenge will use. The printed strings must follow exactly the format below (with the exception of leading or trailing whitespace).
Afrikaans:    Hello Wêreld!
Albanian:     Përshendetje Botë!
Amharic:      ሰላም ልዑል!
Arabic:       مرحبا بالعالم!
Armenian:     Բարեւ աշխարհ!
Basque:       Kaixo Mundua!
Belarussian:  Прывітанне Сусвет!
Bengali:      ওহে বিশ্ব!
Bulgarian:    Здравей свят!
Catalan:      Hola món!
Chichewa:     Moni Dziko Lapansi!
Chinese:      你好世界！
Croatian:     Pozdrav svijete!
Czech:        Ahoj světe!
Danish:       Hej Verden!
Dutch:        Hallo Wereld!
English:      Hello World!
Estonian:     Tere maailm!
Finnish:      Hei maailma!
French:       Bonjour monde!
Frisian:      Hallo wrâld!
Georgian:     გამარჯობა მსოფლიო!
German:       Hallo Welt!
Greek:        Γειά σου Κόσμε!
Hausa:        Sannu Duniya!
Hebrew:       שלום עולם!
Hindi:        नमस्ते दुनिया!
Hungarian:    Helló Világ!
Icelandic:    Halló heimur!
Igbo:         Ndewo Ụwa!
Indonesian:   Halo Dunia!
Italian:      Ciao mondo!
Japanese:     こんにちは世界！
Kazakh:       Сәлем Әлем!
Khmer:        សួស្តីពិភពលោក!
Kyrgyz:       Салам дүйнө!
Lao:          ສະບາຍດີຊາວໂລກ!
Latvian:      Sveika pasaule!
Lithuanian:   Labas pasauli!
Luxemburgish: Moien Welt!
Macedonian:   Здраво свету!
Malay:        Hai dunia!
Malayalam:    ഹലോ വേൾഡ്!
Mongolian:    Сайн уу дэлхий!
Myanmar:      မင်္ဂလာပါကမ္ဘာလောက!
Nepali:       नमस्कार संसार!
Norwegian:    Hei Verden!
Pashto:       سلام نړی!
Persian:      سلام دنیا!
Polish:       Witaj świecie!
Portuguese:   Olá Mundo!
Punjabi:      ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ!
Romanian:     Salut Lume!
Russian:      Привет мир!
Scots Gaelic: Hàlo a Shaoghail!
Serbian:      Здраво Свете!
Sesotho:      Lefatše Lumela!
Sinhala:      හෙලෝ වර්ල්ඩ්!
Slovenian:    Pozdravljen svet!
Spanish:      ¡Hola Mundo!         // Leading '¡' optional
Sundanese:    Halo Dunya!
Swahili:      Salamu Dunia!
Swedish:      Hej världen!
Tajik:        Салом Ҷаҳон!
Thai:         สวัสดีชาวโลก!
Turkish:      Selam Dünya!
Ukrainian:    Привіт Світ!
Uzbek:        Salom Dunyo!
Vietnamese:   Chào thế giới!
Welsh:        Helo Byd!
Xhosa:        Molo Lizwe!
Yiddish:      העלא וועלט!
Yoruba:       Mo ki O Ile Aiye!
Zulu:         Sawubona Mhlaba!

So there are 74 languages that can be used.
Winning Criterion
The solution that can output the phrase in the greatest number of languages wins. In case of a tie, the shorter solution (in bytes) wins.

*The translations for Malagasy and Maltese were marked community-verified, but were clearly incorrect (one was just "Hello World!" and the other "Hello dinja!", but "Hello!" alone translates to "Bongu!"). These were excluded. Also some languages (Arabic, Hebrew, Pashto, Persian and Yiddish) read from right to left on Google Translate, but when copied here they read from left to right. I hope that's okay.

Are we allowed to use a consistent method of counting bytes that is not used by any of the programming languages that are used?

@Zacharý I guess any single encoding that has a representation for all characters used in the answer can be used to count the bytes. Or perhaps the bytes should be counted in UTF-8 for every answer?

If I have a language that uses a different encoding than all the others, should I convert the code to that language's codepage or use the same byte representation? (which would be hard because some of the bytes result in incorrect UTF-8)

@NieDzejkob Convert to a code page that supports all characters in the answer (in all languages) if possible.

@Steadybox The point is: what should I feed to the interpreter?

I'd say either way (converting to the interpreted language's code page or using the same byte representation) is fine.

@NieDzejkob I think the rule for polyglot is have one file with measurable bytesize and can be run by multiple interpreter/compiler. (example)

Note that the exclamation marks in Chinese and Japanese (！, U+FF01) are different from the others (!, U+0021).

23 Befunges, 713 bytes
The only language I really know is Befunge, so instead of multiple languages, I've just gone with multiple implementations of Befunge. I believe this is still valid under PPCG rules, which consider the language to be defined by its implementation.
8023/# !-1401p680p88+79*6+1p238*7+0pg90p$#v0';1';+>9%80p$$$$"ph~s"+3vv
vv_2#!>#-/\#21#:+#:>#\<0/-2*3`0:-/2g01g00p>#< 2#0 ^#1/4*:*9"9"p00***<<
>>$:2%3*-4/3g68*-70p1-0`02-3/-03-2%1+2/-70g+80g65+70g`7++3g68*-70g9`*v
0168:0>0133?45130120340200v00:<+8*+76%4p00+5/4:+-*86g3++98/2%+98g09+<<
                         @>gg#^:#+,#$"!"-#1_@
       !Helo Byd!!!!!Hai dunia!!!!Ciao mondo!!!Hallo Wereld!!!!
       !Hallo Welt!!!Halo Dunia!!!Halo Dunya!!!Bonjour monde!!!
       !Hei Verden!!!Hej Verden!!!Moien Welt!!!Labas pasauli!!!
       !Molo Lizwe!!!Salut Lume!!!Hei maailma!!Sveika pasaule!!
       !Hello World!!Salom Dunyo!!Tere maailm!!Sawubona Mhlaba!
       !Kaixo Mundua!Salamu Dunia!Sannu Duniya!!!!!!!!!!!!!!!!!

The frustrating thing about Befunge, is that although there is an open source reference implementation, and the language itself is dead simple, there isn't a single third-party interpreter (that I'm aware of) that exactly matches the reference behaviour. Every implementation fails in a different way.
On the plus side, this gives us the opportunity to develop a single piece of code that will produce a different result in almost every interpreter. And that's what I'm attempting in the program above.
If anyone is interested in verifying the results, I've tried to group the various implementations into categories based on how easy they are to get up and running (e.g. some people may not be able to run Windows binaries, or may not be willing to build from source, but everyone should be able to test the online interpreters).
Online Interpreters
No installation required. It's usually just a matter of pasting in the code and clicking a button or two. But note that some of these are quite slow, so may need some time to finish executing.
Alexios' Befunge Playground - Salamu Dunia!
Click the Clear... button and paste the code into the input field. Toggle the Edit switch to activate the interpreter, and then click the Run button to begin executing.
Note that this site probably won't work in Browser's other than Chrome.
Befungius - Molo Lizwe!
Paste the code into the input field, making sure to overwrite the existing code. Then click the Run button to execute.
David Klick's Befunge 93 Interpreter - Sannu Duniya!
Paste the code into the Playfield input field, and then click the Run button to begin executing.
Ian Osgood's Befunge-93 Interpreter - Salut Lume!
Paste the code into the input field under the Show button, making sure to overwrite the @ that is already there. Click the Show button to import the code, then click the Run button to begin executing.
jsFunge IDE - Hej Verden!
First close the Help dialog, then click the Open/Import toolbar button (second from left), paste in the code, and click OK. To execute, click the Run Mode button (fourth from left), and then Start (fifth from left).
Also note that a few of the console-based interpreters are actually available on TIO, so while they aren't technically online interpreters, they can be tested online. For those that are supported (currently BEF, FBBI, MTFI and PyFunge), I've included a Try It Online! link next to their entry.
Java IDEs
You'll need to have the Java run-time installed for these, but they should theoretically work on any platform. Only tested on Windows though.
Ashley Mills' Visual Befunge Applet - Moien Welt!
This was initially an online applet which is unfortunately no longer available, but you can still download the jar and run it locally as a desktop application. You'll need to paste the code into the Program Editor window, then click the Convert button, followed by the Run button.
WASABI: Wasabi's A Superbly Asinine Befunge Interpreter - Hallo Welt!
To paste in the code, right click in the top left corner of the editor window (it must be the very top left) and select the Paste menu item. Then enable the Full Speed check box (otherwise it'll take forever), and click the Run! button to begin executing.
YABI93: Yet Another Befunge93 Interpreter - Halo Dunia!
Press Ctrl+A, Ctrl+V to paste the code into the editor window, being sure to overwrite the default source. Then click the Start button to begin executing.
Windows IDEs
You'll typically need Windows for these, although in some cases there may be binaries available for other operating systems. I can't promise the code will work on other platforms though.
BefunExec - Hello World!
You can't paste the code into the editor, so you'll first need to save it to disk somewhere. Then from the IDE, use the File > Open menu to load the code from disk, and select the Simulation > Run/Pause menu to run it.
BeQunge - Labas pasauli!
Press Ctrl+V to paste in the code, and then click the Debug toolbar button (the blue cog) to begin executing. Once the Debugger panel appears, you'll want to set the Speed to maximum - the button to the right of the slider - otherwise it'll take forever to finish.
Fungus - Tere maailm!
Press Ctrl+V to paste in the code, and then press F5 to run it.
Visbef: Visual Befunge '93 for Windows - Hallo Wereld!
You can't paste the code into the editor, so you'll first need to save it to disk somewhere. Then from the IDE, press Ctrl+O to open the file browser and load the code from disk, and press F5 to run it.
Windows Console Apps
Again these typically require Windows, although other platforms may be available, but not guaranteed to work.
In all cases the code will need to be saved to a file on disk and the filename passed to the interpreter as a command line parameter (source.bf in the example command lines given below). Also note that some of these are technically Befunge-98 interpreters, and must be run with a particular command-line option to force a Befunge-93 compatibility mode. If you don't do that, you won't get the correct results.
BEFI: Rugxulo's Befunge-93 Interpreter - Hei Verden!
Command line: bef93w32 -q source.bf
CCBI: Conforming Concurrent Befunge-98 Interpreter - Sveika pasaule!
Comand line: ccbi --befunge93 source.bf
MTFI: Magus Technica Funge Interpreter - Hai dunia!
Command line: mtfi -3 source.bf (Try it online!)
Python and PHP Console Apps
These require the appropriate scripting language installed - either Python or PHP.
Befungee - Helo Byd!
Command line: befungee.py source.bf
PyFunge - Halo Dunya!
Command line: pyfunge -v 93 source.bf (Try it online!)
Bephunge - Bonjour monde!
Command line: php bephunge.phps source.bf
Source-only Console Apps
These will need to be built from source, and that's usually easiest with a *nix-like environment. On Windows I use the Windows Subsystem for Linux.
BEF: Befunge-93 Reference Distribution - Ciao mondo!
Command line: bef -q source.bf (Try it online!)
cfunge - Sawubona Mhlaba!
Command line: cfunge -s 93 source.bf
FBBI: Flaming Bovine Befunge-98 Intepreter - Hei maailma!
Command line: fbbi -93 source.bf (Try it online!)
Fungi - Kaixo Mundua!
Command line: fungi source.bf
Rc/Funge-98 - Salom Dunyo!
Command line: rcfunge -93 source.bf
How it works
The challenge with this was finding the fewest number of tests that provided the most differentiation between interpreters. In the end it came down to four main test sequences:

The first is an out-of-bounds memory read from offset -1,1. In theory this should always return 32 (ASCII space), but there were actually 10 variations in practice. This test is complicated by the fact that two of the interpreters crash on an out-of-bounds read, so a couple of special-case tests (division rounding and space bridging) were required to force those two back into bounds.

The second sequence is a test of Befunge-98 functionality - specifically the instructions ; and '. Almost all of the interpreters are Befunge-93, or are run in Befunge-93 compatibility mode, so they should just ignore those instructions. In practice there were 6 different ways in which this sequence was interpreted.

The third test checks the range of memory cells. In the reference interpreter, memory cells are signed 8-bit, but other implementations vary in range from 8-bit to unbounded, some signed and some unsigned. However, for the purposes of this test, we only had to distinguish between 5 of those variants.

The fourth and final sequence is a combination of underflow and negative division tests. There are a number of ways in which interpreters get underflow wrong, and there are at least 3 different ways in which the division and modulo instructions are implemented, but there were only 3 combinations we cared about here.

Each of these sequences returned a single number, and those four numbers were combined (via some basic arithmetic and translation tables) to produce a final value in the range 0 to 22. That value could then be used as an index to lookup the actual message to display.

Pretty cheep method, but there is no way I'm beating this. Now we could probably adjust this and squeeze BrainFuck variants in there.

I assure you it's not as easy as you might imagine. It's a challenge just getting the code to run without crashing in 20+ buggy interpreters. If I wanted to be cheap, I would have used Befunge-98 and simply queried the implementation handprints (3y).

I'm referring to cheap as in how you use only befunges, but this is actually very impressive.

This is an incredibly impressive, but is it possible to explain why different interpreters treat it differently?  Maybe not all 23 versions, but a few examples of the behavioral differences you're exploiting, at least?

@JackBrounstein I've added a bit of an explanation at the end of the answer.

16 languages, 1363 bytes
 #define ip"MemuL tulaS",,,,,,,,,,"!",@++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.@,kc"Kaixo Mundua!"v#!
#define print(A,B,C)main(){printf("Helo Byd!");}//ss                                                                          ;ooooooooooooooooooo"Moni Dziko Lapansi!"<[-
#ifdef __cplusplus//p                                                                                ;;];;
#include<cstdio>//ffffffffff?
#define print(A,B,C)int main(){printf("Halo Dunya!");}//ssp
#endif//;  [;;;;;;;;;     "!etejivs vardzoP"]
#ifdef __OBJC__//;;;;;
#define print(A,B,C)main(){printf("Hallo Welt!");}//ss
#endif//\
"""echo" "Salom Dunyo!";"exit";puts"Moien Welt!";\
__END__
#define B//\
"""#;;;;;
print(["Hai dunia!","Hej Verden!","Halo Dunia!"][(int(1>0)is 1)+~int(-1/2)*2])
#define s eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeejeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeejiiiiiiiijeeeeeeeeeeeeeejiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeejeejijiiiiiiiiiijeeeeeeeeeeejiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiij
#define U   !"!dlereW ollaH"<           ;
#define T@,kc"Sannu Duniya!?%?"

Try it online!
(use "switch languages" to change language)

Python 3 = Halo Dunia! (Indonesian)

Python 2 = Hej Verden! (Danish)

Python 1 = Hai dunia! (Malay)

C (gcc) = Helo Byd! (Welsh)

C++ (gcc) = Halo Dunya! (Sundanese)

Objective C (clang) = Hallo Welt! (German)

Brainfuck = Hello World! (English, obviously)

Befunge-93 = Salut Lume! (Romanian)

Ruby = Moien Welt! (Luxemburgish)

Bash = Salom Dunyo! (Uzbek)

Befunge-98 (PyFunge) = Kaixo Mundua! (Basque)

Unefunge-98 (PyFunge) = Sannu Duniya! (Hausa)

Cardinal = Hallo Wereld! (Dutch)

Alphuck = Ciao mondo! (Italian)

><> = Moni Dziko Lapansi! (Chichewa)

Fission = Pozdrav svijete! (Croatian)

Any golfing tips are welcome (especially on the Brainfuck)!!
Thanks to @JonathanFrech for -1 byte! Also, thanks to @ovs for -40 bytes!
How (general ideas, I actually forgot specifics)??
The languages can be put into four groups:

Macro: C, C++, Objective C
Comment: Python3, Python2, Python1, Ruby, Bash
Dimensional: Befunge-93, Befunge-98, Unefunge-98, Cardinal, ><>, Fission
Vulgar: Brainfuck, Alphuck

The Macro languages see # as the start of a preprocessor directive. These are used for three reasons: to house code for other groups, to distinguish among Macro languages, and to actually define a macro. All three use // as comment, so after that we store code for the other groups. Also, the backslash continues the comment in these languages.
The Comment languages see # as the start of a comment. The quirk here is the triple quotes, which distinguish the Pythons from Ruby from Bash. And to distinguish Python 1 from 2 from 3, we use a distinguishing feature in all three, along with an array of outputs. Oh yeah, there's also that __END__. This is used to end the code for some (can't remember exactly which ones) of the Comment languages.
The Dimensional languages are distinguished in a way that is hard to explain. One has to know the specifics of each language to figure it out. For example, # is only a skip in the fungeoids, while it does various different things in the other languages. The code is strewn about everywhere for these languages.
And finally, we arrive at the Vulgar languages. These two ignore everything that isn't in their set of valid characters. A balancing act has to be played with these languages and the others, as the code already contains characters in the character sets.
Edit: Wow... Somehow I only now realized Brainfuck did not seem to work, so that's fun!

Can you combine the strings in the Python submission into one big string and use string slicing to index into it it? e.g. "abcabcabc"[n::3] -> "aaa" for n = 0, "bbb" for n = 1. I feel like there's probably a way you can slice it and save bytes by including the duplicated characters in the slicing somehow (like H and !).

Eh, I'll do something like that when someone comes near my score.

I think -2*int(...)-1 can be +~int(...)*2, albeit the Python version to language mappings change.

Cool! the brackets in ["Hai dunia!","Hej Verden!","Halo Dunia!"] shield the commas!

They wouldn't need to, I abuse the fact that the TIO brainfuck defaults 0 (or does nothing, I can't tell) if it runs out of input from the user. There are 9 other unshielded commas that abuse this fact.

Whoops, I meant Bash, not powershell >_<

You can replace the befunge-98 part @,,,,,,,,,,,,, with @,kc (the same can be done for the unefunge part)

Like that matters now ... but thanks!

Is there a reason you're not using the +[++[<+++>->+++<]>+++++++]<<<--.<.<--..<<---.<+++.<+.>>.>+.>.>-.<<<<+. for your BF part? (source)

The comma. The comma is why I'm not using that one.

The rep ... is unreal.

@Zacharý If the problem is that the commas are reading input into the cell, can't you just add a > to get move to a cell that's still zeroed and then do primo's 78 byte BF program?

The comma in the output of +[++[<+++>->+++<]>+++++++]<<<--.<.<--..<<---.<+++.<+.>>.>+.>.>-.<<<<+. is the problem, I might be able to adjust it ever so slightly (and even reduce bytes), but it still wouldn't matter because of the 23 befunges answer.

I've added an explanation, for anybody that wants to see it.

15 languages, 532 bytes
# ;"!audnuM oxiaK">:#,_@R"Hej Verden!";;@,kb"Tere maailm!";# w"!amliaam ieH"ck,@oooooooooo"Hai dunia!"
`true #{puts'Hola món!'}` \
__END__
"Hola Mundo!" puts
case `ps -p$$ -oargs=` in \
b*)echo Hallo Welt!;;k*)echo Ndewo Ụwa!;;d*)echo Ciao mondo!;;z*)echo Moien Welt!;;a*)echo Hei Verden!;;esac
true;
#xx
#x%"Olá Mundo!"x
#xx+++[++[<+++>->+++<]>+++++++]<<<--.<.<--..<<---.<+++.<+.>>.>+.>.>-.<<<<+.

Try it online!

Kaixo Mundua! in Befunge-93
Hej Verden! in Fission
Tere maailm! in Unefunge-98
Hei maailma!! in Befunge-98
Hai dunia! in ><>
Hola món! in Ruby
Hola Mundo! in GolfScript
Hallo Welt! in bash
Ndewo Ụwa! in ksh
Ciao mondo! in dash
Moien Welt! in zsh
Hei Verden! in ash
Olá Mundo! in Cardinal
Hello World! in brainfuck, courtesy of primo.
Helo Byd! in Whitespace

Explanation
Line 1 distinguishes between five 2D esolangs:

><> reads # as a mirror, wraps around to the left, prints "Hai dunia!" and crashes (@). All the Funges read it as a trampoline and go right.
Befunge-93 ignores ;, prints Kaixo Mundua! and exits (@).
The ’98 Funges jump from the first ; to the second, then from the third ; to the fourth. w is a NOP for Befunge-98, printing Hei maailma!.
But w reflects the instruction pointer in Unefunge-98, printing Tere maailm!.
Fission doesn’t start in the top-left corner at all. R"Hej Verden!"; is executed. (Another instruction pointer starts from the D in __END__, but it does nothing then dies to the ; in true;.)

Ruby sees `true #{puts'Hola món!'}`, then __END__.
GolfScript sees `, then true (NOP), then a comment; then __END__ (NOP); then "Hola Mundo!" puts (this is executed); then case (NOP), then ` (crashes on empty stack).
The shells see a comment, then an invocation to true (NOP), then invocations to unknown commands __END__ and "Hola Mundo!" (which error to STDERR but execution continues), then the case statement which distinguishes based on the first letter of the name of the current process.
Cardinal is another 2D esolang which starts at the %, sending 4 IPs up, down, left, and right. They're all killed by the surrounding x commands, but one prints "Olá Mundo!" before dying.
The brainfuck code is primo’s, prefixed with ++ to counteract the dashes in ps -p$$ -oargs=.
The whitespace in my code is executed as the Whitespace program
 push 0
 push 0
label_0:
 push 0
 push 0
 drop
 drop
 push 72; printc
 push 101; printc
 push 108; printc
 push 111; printc
 push 32; printc
 push 66; printc
 push 121; printc
 push 100; printc
 push 33; printc

which prints Helo Byd!
EDIT: I forgot that adding UDLR characters breaks the Fission program, so I’ve changed the strings up to avoid these.

I'll get you soon.

I think I surrender now, you did an amazing job.

I feel a little bad, because your solution has the languages interacting in far more interesting ways! I really just padded my “5 shells” answer with esolangs that are easy to polyglot with one another… >.<;

It's actually not interesting, the #define trick is abused to no end.

Now, if anyone can polyglot these languages with D, I will forever be in awe. (#define isn't a thing in D... that gets in the way of polyglotting a lot). Also, I really need to learn whitespace.

Unfortunately it seems that the Fission code has broken due to some edit. At least it produces rather erratic output on TIO.

No wonder my fission code wasn't working! In that case, I have the lead again.

oh, there are more uppercase letters now, I see. I’ll fix it in a bit by picking different Hello Worlds.

I have you now! (16 languages)

4 languages, 75 bytes
#"Hej Verden!"o|
print ([]and(0and"Hola món!"or"Helo Byd!")or"Hai dunia!")

Python - Hai dunia!
Perl - Helo Byd!
Ruby - Hola món!
Haystack - Hej Verden!

7 languages, 221 bytes
<?php echo'مرحبا بالعالم!';die?>h+#;"!dlereW ollaH"ck,@;
;echo Kaixo Mundua!;                        <@,k+4f"ሰላም ልዑል!"

Բարեւ աշխարհ!
@,k+4f"Përshendetje Botë!";XXXX;"Hello Wêreld!"

Since this program contains some nasty characters, here's an xxd:
00000000: 3c3f 7068 7020 6563 686f 27d9 85d8 b1d8  <?php echo'.....
00000010: add8 a8d8 a720 d8a8 d8a7 d984 d8b9 d8a7  ..... ..........
00000020: d984 d985 2127 3b64 6965 3f3e 682b 233b  ....!';die?>h+#;
00000030: 2221 646c 6572 6557 206f 6c6c 6148 2263  "!dlereW ollaH"c
00000040: 6b2c 403b 0a0c 3b65 6368 6f20 4b61 6978  k,@;..;echo Kaix
00000050: 6f20 4d75 6e64 7561 213b 2020 2020 2020  o Mundua !;
00000060: 2020 2020 2020 2020 2020 2020 2020 2020
00000070: 2020 3c40 2c6b 2b34 6622 e188 b0e1 888b    <@,k+4f"......
00000080: e188 9d20 e188 8de1 8b91 e188 8d21 220a  ... .........!".
00000090: 0ad4 b2d5 a1d6 80d5 a5d6 8220 d5a1 d5b7  ........... ....
000000a0: d5ad d5a1 d680 d5b0 210a 402c 6b2b 3466  ........!.@,k+4f
000000b0: 2250 c3ab 7273 6865 6e64 6574 6a65 2042  "P..rshendetje B
000000c0: 6f74 c3ab 2122 3b58 5858 583b 2248 656c  ot..!";XXXX;"Hel
000000d0: 6c6f 2057 c3aa 7265 6c64 2122 0a         lo W..reld!".

Unefunge-98 prints Përshendetje Botë! - Try it online!
Befunge-98 prints Hallo Wereld! - Try it online!
Trefunge-98 prints ሰላም ልዑል! - Try it online!
Actually prints Hello Wêreld! - Try it online!
Bash prints Kaixo Mundua! - Try it online!
PHP prints مرحبا بالعالم! - Try it online!
Retina prints Բարեւ աշխարհ! - Try it online!

Why not <?='مرحبا بالعالم!';die?>? It's valid PHP (essentially the same as <?php echo ... ?>),

@IsmaelMiguel because I forgot about that feature... simple as that

5 languages, 168 bytes
  //"!nedreV jeH",,,,,,,,,,,@R"Hello World!"*#x
///"!mliaam ereT">:?v; x"!dyB oleH"           %x
//               ^ o<                         x
// >`Sawubona Mhlaba!`;

I think 2-dimensional languages are interesting.
><> prints Tere maailm!
Befunge-98 prints Hej Verden!
Beeswax prints Sawubona Mhlaba!
Cardinal prints Helo Byd!
Fission prints Hello World!
Try it online! (Cardinal)

I see great potential here, since // are comments in a lot of languages.

@Zacharý That's the only reason most of them are there. Right now, two are used for ><> and one for Beeswax. The ones in the first two columns don't do anything.

Can you explain the control flow for Beeswax? I want to see if it is suitable for this challenge.

@Potato44 It's a 2-d language that interprets the code as a bounded hexagonal grid, so pointers can move in 6 directions. Bees (pointers) are spawned by the characters */\_ and can be redirected in fixed directions or by mirrors or rotation. See here for more.

You can cut it by 1 byte because for the beeswax part the ; after the second backtick is not necessary. The Bee just runs off the honeycomb towards the right.

2 languages, 16 characters, 24 bytes
Well, at least that's shorter than both strings.
L"שלום עולם"33ç«

05AB1E - שלום עולם!
Help, WarDoq! - Hello World!
Help, WarDoq! can add two numbers and test for primes, so it is considered as a valid programming language per this meta post.

IIRC, they are not one byte in 05AB1E, it's only due to limitations of TIO.\

@Zacharý are you sure? I know hebrew chars to be 1 bytes in some encodings. Could be overlapping char codes.

Do you see Hebrew here?

@Zacharý fixed (I think that would make 24 bytes)

3 languages, 67 62 bytes
To qualify for this bounty (100 rep).
x:Helo Byd!
O
y:"Hai dunia!"
u?`h;`4$'5^5D+Asi:^:E+IvIvAB*vhm,

Add++: Try it online!
Foo: Try it online!
Somme: Try it online!
Explanation
Add++
Add++ sees:
x:Helo Byd!
O

"Output x's string"
y:"Hai dunia!"

"Set y to a different string"
u?`h;`4$'5^5D+Asi:^:E+IvIvAB*vhm,

"idk something weird, I'll error out"
Foo
Foo sees:
x:Helo Byd!
O
y:"Hai dunia!"

"Oo, quotes, I'll output those."
u?`h;`4$'5^5D+Asi:^:E+IvIvAB*vhm,

"Uh... something about a mode? Idk, I'll error out."
Somme
Somme sees, well, this:
8s+vi:4+vhIvE-Asi:^:E+IvIvAB*vhm,

Every column is converted to code points, then 32 is subtracted from them, then each is taken modulo 95. This corresponds to these characters, which print, "Hei Verden!"

Well, the week is up, and you're the shortest (and only) competing answer, so congratulations on the bounty!

@cairdcoinheringaahing Thanks! :D

4 languages, 138 bytes
''' '/*' '''
print(["Bonjour monde!","Hei maailma!","Hallo Wereld!"][((int(not 0)is 1)+2*int(1/2==0))-1])
''' '*/print("Hallo Welt!")' '''

Try it online!
Py1, Py2, Py3, Proton; thanks to Mr. Xcoder; translated from Zacharý's answer

4 languages (Proton, Py1, Py2, Py3). Inspired by Zacharý answer.

@Mr.Xcoder Oh cool, thanks!

5 languages, 213 bytes
I decided to try and write a small answer myself.
#include<stdio.h>
#define hint(x)int main(){auto i=.5;puts(i?"Hallo Welt!":"Hei maailma!");}
#define R "Pozdrav svijete!";
#if 0
hint=print
goto=len
s="Tere maailm!"
goto("endif")
s="Hallo Wereld!";
#endif
hint(s)

Languages:
C:                                       Hei maailma!      (Finnish)
C++:                                     Hallo Welt!       (German)
Python 3:                                Hallo Wereld!     (Dutch)
Operation Flashpoint scripting language: Tere maailm!      (Estonian)
Fission:                                 Pozdrav svijete!  (Croatian)

C and C++ see the code as:
#include<stdio.h>
#define hint(x)int main(){auto i=.5;puts(i?"Hallo Welt!":"Hei maailma!");}
#define R "Pozdrav svijete!"; // Unused macro
hint(s)

auto i=.5; is (in effect) equal to int i=0; in C, but equal to double i=0.5; in C++.
Try it online! (as C)
Try it online! (as C++)
Python 3 sees the code as:
hint=print
goto=len
s="Tere maailm!"
goto("endif")         # Calculate string length and discard the result.
s="Hallo Wereld!"
hint(s)

Try it online!
OFP scripting language sees:
; (A semicolon at the beginning of a line comments the line in a script.)

; Four labels with strange names.
#include<stdio.h>
#define hint(x)int main(){auto i=.5;puts(i?"Hallo Welt!":"Hei maailma!");}
#define R "Pozdrav svijete!";
#if 0

; Assign a null value to "hint", no practical effect. Same for "goto".
hint=print
goto=len

; Assign the string to variable "s".
; I would like to have used the Czech phrase for OFP (because it's a Czech game),
; but it didn't recognize the 'ě' and printed a '?' instead.
s="Tere maailm!"

; Jump to label "endif".
goto("endif")

; This reassignment of "s" gets skipped.
s="Hallo Wereld!";

; Declare a label called "endif".
#endif

; Print the string "s".
hint(s)

Fission sees:
R "Pozdrav svijete!";

Try it online!

4 languages, 115 bytes
print ((("b" + "0" == 0)and eval('"Hallo Wereld!"'))or(0 and"Hello World!"or(1/2and"Hei Verden!"or"Hej Verden!")));

Perl 5 gives Hallo Wereld! - TIO
Ruby gives Hello World! - TIO
Python 2 gives Hej Verden! - TIO
Python 3 gives Hei Verden! - TIO

107 bytes — print (((“b”+”0"==0)and eval('"Hallo Wereld!"'))or(0and"Hello World!”or((1/2and"Hei"or"Hej")+" Verden!")));

Four Languages, a whopping 650 bytes
//iiciccepepceaiiiaiaiaicccsascciijceeeeeejccijjccjceaajaajcccjeeejaajaaijcccej
//[
/*
GOTO end
*/
//pis
//p
//p
//\u000Apublic class Main{public static void main(String[]a){System.out.print("Salut Lume!");}}
/*
lblend
print Hola Mundo!
//s
*/
//]
//s
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++++++++++++++++.--------.++++++++++++++.-------------------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++.-.----------.+++++++++++.------------------------------------------------------------------------------.

Java gives "Salut Lume!" Try it!
S.I.L.O.S gives "Hola Mundo" Try it!
Brainfuck gives "Ciao mondo!" Try it!
(The alphuck code is modified from the Esolangs page on Alphuck)
Alphuck gives "Hello World!" Try it!
The line beginning \u000A is the Java code. The code on line one is the Alphuck code, which will ignore the rest of the code (as long as "p" and "s" are balanced.
The relevant line for SIL/S.I.L.O.S is "print Hola Mundo", and the brainfuck code is at the end and will ignore the rest of the code.

I think you can golf the BF code some using the constants provided by this page and the techniques used there.

@cole I try to take another look at the bf code when I get some more time to optimize it. Essentially, I don't think it's enough to just use constants, I'm going to have to define a recurrence relation

78 for 'Ciao mondo!': +>++>+>+++[+++++[>+++++++++++>++++<<-]+++<]>>--.>+.>.>-.>.<--.++.-.<+++.>+.>+. using the byte sequence [69, 104, 97, 112, 32]

3 languages, 184 181 bytes
Only works once - you have to clear the list to run it again.
when gf clicked
add<[]=[]>to[c v
if<(join(item(1 v)of[c v])[d])=[1d
say[Helo Byd!
else
repeat(300000
add[]to[c v
end
if<(length of[c v])>[250000
say[Hello world!
else
say[Hai dunia!

Scratch 1.4: Helo Byd!
Scratch 2.0: Hello world!
Scratch 3.0 beta as of the time of this answer: Hai dunia!
Explanation
In Scratch 1.4, adding a boolean to a list adds 1 or 0, but in 2.0 and up it adds true or false, but when checking if the item is equal to 1 with <[]=[]>, it will return true if the item is either 1 or true, so we add another letter to it and check that.
In Scratch 3.0, lists have a maximum size of 200,000 items, so we just add a bunch of items and see if the list is that long.

17 languages, 1043 bytes
'abddef'*((1<2)//2);''';;;;`Hai dunia!`,#d((A{[                                      ;"!odnom oaiC"S<       v<    v\
*'');typeof Buffer<'g'?console.log(`Sveika pasaule!`):print(`Tere maailm!`)+`//#@,,,,,,,,,,,<     v       v'<|-8y2< @@@@@@@
$ 'main'                                  //       @,,,,,,,,,,,,,"Kaixo Mundua!"<v          ^"Molo Lizwe!"<         """""""
 \-[Labas pasauli!]o-#`//%"Hei maailma!"x;                                      |<+1$Y            <                 Hlowrl!
// #                                             @,,,,,,,,,,,,,,"Bonjour monde!"< @,,,,,,,,,,,"Hei Verden!"^'<      al eed"
//#                                                                              >o<'Salom Dunyo!'~~^?@001~~~~~~~~~\""""""
//#''';print(1/2 and 'Moien Welt!' or 'Salamu Dunia!')#){{i                                      }ddd}iic{iii}dc{i}dddciiic{{d}ii}ic{iii}iiiic{iiiii}iiiiic{dd}dc{{d}iii}iiic}ddddddddddddddddddddddddddddddddd\M(\o)\i\e\n\ \W\e\l\t\!]+[+[<<<+>>>>]+<-<-<<<+<++]<<.<++.<++..+++.<<++<---.>>.>.+++.------.>-.>>--.

Four Befung(i/es/en), two Pythons, two Javascripts, two ><>es and a bunch of other random esolangs. This is a horribly ungolfed mess, but I'm proud of it.
Gol><> prints Ciao mondo!
><> prints Salom Dunyo!
Python 2 prints Salamu Dunia!
Python 3 prints Sawubona Mhlaba!
Javascript (V8) prints Tere maailm!
Vyxal prints Hai dunia!
Deadfish~ prints Helo Byd!
Befunge-93 prints Molo Lizwe!
Befunge-96 prints Kaixo Mundua!
Befunge-97 prints Bonjour monde!
Befunge-98 prints Hei Verden!
Splinter prints Moien Welt!
Rail prints Labas pasauli!
Javascript (Node.js) prints Sveika pasaule!
Brainfuck prints Hello World!
Cascade prints Hallo wereld!
Cardinal prints Hei maailma!

3 languages, 61 bytes
;“,ḷṅḳȦ»Ḋḷ“
x:Hai dunia!
O
y:"Helo Byd!"
;”

Add++ outputs Hai dunia!
Jelly outputs Hello World!
Foo outputs Helo Byd!
Just because I set the bounty doesn't mean I can't take part :D (ab)uses the brilliant string setting trick that Conor found for Add++
How it works
Add++
;“,ḷṅḳȦ»Ḋḷ“     ; A comment. This does nothing
x:Hai dunia!    ; Set the x accumulator to the string "Hai dunia!"
O               ; Output x
y:"Helo Byd!"   ; Set the y accumulator to the string "Helo Byd!"
;”              ; Another comment

Jelly
Comments in Jelly can be formed with the syntax ḷ“comment”, which is how the Add++ and Foo code is ignored. The code that is actually executed by Jelly is
;“,ḷṅḳȦ»Ḋ - Main link. Arguments: None
 “,ḷṅḳȦ»  - Yield the string "Hello World!"
;         - Append 0, yielding "0Hello World!"
        Ḋ - Remove the first character, yielding "Hello World!"

Foo
Foo ignores all characters here aside from "Helo Byd!", which, as it's in quotes, is outputted.

3 Languages, 274 Bytes
#define b++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+>
#include<stdio.h>
#define p(x)int main(){printf("नमस्ते दुनिया!");}
#if 0
p=print
goto=len
goto("endif")
s="Helo Byd!";
#endif
p(s)

C:नमस्ते दुनिया!
Python: Helo Byd!
Brainfuck: Hello World!
Try it online!