[Question]
  [
# Challenge
You have one string of input bytes, output *only* the last byte in it.
# Rules
Your submission may be a program or function outputting the last byte in the input which
* is either a string, *stdin* or command-line arguments, and
* is non-empty.
I was trying to solve this with brainfuck, however all languages are allowed to participate. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'").
# Examples
```
"?" -> "?"
"29845812674" -> "4"
```
  
[Answer]
# [Attache](https://github.com/ConorOBrien-Foxx/Attache), 4 bytes
```
Last
```
[Try it online!](https://tio.run/##SywpSUzOSP2fpmBl@98nsbjkv19qakpxtEpBQXJ6LFdAUWZeSUhqcYlzYnFqcXSajkK0kr2SjoKSkaWFiamFoZGZuQmIm5Gak5Ovo1CeX5SToqgUG/sfAA "Attache ‚Äì Try It Online") (If the input could be a list of characters, `&/S` could work.)
## Alternatives
**5 bytes:** ``@&-1`
**8 bytes:** `&/S@List`
**10 bytes:** ``@¬´_,-1¬ª`
**10 bytes:** `Fold!Right`
**10 bytes:** ``@<~_,-1~>`
**10 bytes:** ``^^&:Right`
**10 bytes:** `{Right^^_}`
**11 bytes:** `Get¬´_,-1¬ª`
**11 bytes:** `Get<~_,-1~>`
**12 bytes:** ``@¬´_,#_-1¬ª`
**12 bytes:** ``@<~_,#_-1~>`
**13 bytes:** `Get¬´_,#_-1¬ª`
**13 bytes:** `Get<~_,#_-1~>`
[Answer]
# x86-16 machine code, 2 bytes
As @CodyGray correctly points out, taking input as a string and output to a register removes the bulk of the standalone program version.
Input string is in `SI`, length in `CX` and output character is in `AL`:
```
F3 AC  REPZ LODSB      ; start at memory location pointer in SI, put next value in AL,
                       ; loop CX number of times. The last char will be in AL when done.
```
Or **4 bytes** as a "Pascal string" (length is prepended to beginning of string):
```
AC     LODSB           ; first byte is string length
91     XCHG AX, CX     ; move length to CX for loop 
F3 AC  REPZ LODSB      ; start at memory location pointer in SI, put next value in AL,
                       ; loop CX number of times. The last char will be in AL when done.
```
Or **5 bytes** as a "C string" (zero/null terminated), input in `DI`:
```
F2 AE     REPNZ SCASB     ; scan for value in AL (0), end when found and advance DI
8A 45 FE  MOV AL, [DI-2]  ; DI is now two bytes ahead of last, put value of DI-2 into AL
```
# x86-16 machine code, IBM PC DOS, ~~12~~ ~~11~~ 10 bytes
Or as complete program as IBM PC DOS executable. Input is from command line, output is to console.
```
B3 80   MOV  BL, 80H            ; BX to DOS PSP at 80H 
8A 07   MOV  AL, BYTE PTR[BX]   ; get command line tail length 
D7      XLAT                    ; AL = [BX+AL] 
B4 0E   MOV  AH, 0EH            ; PC BIOS write to screen function  
CD 10   INT  10H                ; display  
C3      RET                     ; exit to DOS
```
**Output:**
[![enter image description here](https://i.stack.imgur.com/H3s4u.png)](https://i.stack.imgur.com/H3s4u.png)
[Answer]
# Brainf\*\*\*, 7 bytes
```
,[>,]<.
```
[Answer]
# MATL, 2 bytes
```
0)
```
MATL uses 1-based modular indexing so this solution grabs the element in the `0`-th position of the input which is the same as the last since the `0` wraps around to the end.
Try it out at [MATL Online](https://matl.io/?code=0%29&inputs=%27123%27&version=20.10.0)
**Explanation**
```
    % Implicitly grab the input
0   % Push the literal 0 to the stack
)   % Use this zero to grab the character at the end of the string
    % Implicitly display the result
```
[Answer]
# [INTERCAL](http://www.catb.org/%7Eesr/intercal/), ~~270~~ ~~258~~ ~~247~~ 246 bytes
```
DO,1<-#1PLEASECOMEFROM(2)DOWRITEIN,1DO.1<-,1SUB#1DO.5<-#1$.1~#256DO.2<-.3DO(1)NEXTPLEASE.2<-!3~#15'$.3~#240PLEASE.2<-!2~#15'$.2~#240PLEASE.2<-!2~#15'$.2~#240DO(1010)NEXTDO,1SUB#1<-.3DOREADOUT,1(1)DO(1002)NEXTDO(1009)NEXTDO.3<-.3~#255(2)DOFORGET#1
```
[Try it online!](https://tio.run/##fU9NC4JAEP0tsUIKujijawperF1DyDbWlbpGdAiiQ3T2r2@OeujUaT7em/fePF6f@/t2fTondQhlxOB0UFWndrpVtdGtj4HUZ9NY1RxDkJqPnBC6fstoEHTgcRgYimycsYx4IrUPwVFd7KxEy1UyMBBrj48V0/gHwAXA/wBpxhBPshR0CjCbGVVJ3dsQRteJFuNCo75Yep4Qm3KK6aVam72yDJzDIk9FDpht0i8 "INTERCAL ‚Äì Try It Online")
*-8 thanks to È≥¥Á•ûË£ÅÂõõÁÇπ‰∏ÄÂè∑ removing `DOGIVEUP` to terminate by NEXT stack explosion, opening up another -4 changing a `PLEASE` to `DO`.*
*-11 removing some grouping from the bit-reversing expression from hell. It seems that binary operators generally act right-associative in C-INTERCAL, though having no precedence among themselves.*
*-1 trying something else for bit reversal--definitely expected more savings than that! A more principled approach might be able to do it in two steps unless there's some obvious invariant I'm missing, but I'm too tired to take a stab at that just yet.*
Writing this was... interesting. I was thinking I might want to use INTERCAL [to INTERCALate](https://codegolf.stackexchange.com/questions/50798/is-it-a-leap-year), but I'm a bit less sure now.
[Ungolfed and commented:](https://tio.run/##3VZdb9s2FH3Pr7hFCjgGHM0fy4YCAYYsdVsDqV04zrpXWqJsLhIpkJRVv/SvZ@eSsmMH6Yy@zghiQ7oizz3n3EMp7aVNRfH0RO3n/Yx6g@vL8wEdfr7cjW/uxzSdLcb0VVIjtCe/lqR0VXsS1ooteUNGF1tai40kV4lUUm4srkmShSyl9j1yhpSnRhVFrPXiUYYKgVXIq1KeHQC5nX0e04f57DNdDLuHN77OJwAymQLqawgnOcApR/hjkLmyztNy67FV/gy7BygdAGmswh3lHW1EUcskSWiJplRO2rwowrNn9J@fysqNMnW7FpVK4/d@bSpNRsOr35LDZhLQ3RvcP/x5Pji6fMUqvH0z@H6OJzove0yuuL0Rw3wWAldQ26MhGVy0jXJHfCbD68tkdHjlYtCl6fjvxdmJtl6w28iOlYQdZI9/b1jpWmcBicT3Ic0JTU3DZaSlzNgllVWwD3ywFOkjGZSA8tvLyXQxnt/e3HXcCTDRbpNfZhBHk7GZtLxsJuFlEA57roXf@0ykvhYFvBa2hQXrpbe4GL0RZYHGjlZG6dUzvtya8mcEZxdfOM9btir3SICLRvl12OqFNTKZi7rw7Z79bqxGoSYrRRbhLdk6LZts4BNgmNBG2MwldG@OyFmZfUPt/s1ujMGcclURJ/jo/k6wnL/BiaH5@OY9zR4WrOcJLOhWWief29i3t1MgIuJxoLlgv@K2wG2kReoP2mdj60xtVBaF5IWg86oIi5eEiyewMBMcQ9@ggXPK6B5NDpaIRuRlgQiUrEWxkUe8U62hLHtKZJCmrpgW0fYoiuTseMzo@pLejL6fD6469Db8Gv7a77xSM9zXDH@i5niC@4N@HOLXhjUZgB72E@dySAcmQ2EOmrVK15wYaGFLqdEbqZVk4yO0G9Zpa@q9BfaaAdRetiMgbYQx5GT0g9Sgf2okMcPhGsMZjPjIaCU5/uemhPy6LqUV4Fo7z4WtCqmxlm2BhzhUDnfemRIQDhFNOwv6OPlrTA9fXs2xO7NSOPp2gVVZs7KiTOiTaVjWHkcrIGdGdzzhVirzmu0XU0b4XQDilFjzFJcGmahci7B3KsTauPwwm38cLygVvMujlBWba58ZLKtreeasjoL3hz8W3HP2hX8FRyHEdltXqCX6gKXx7ACaftvrX5nK8VkC4a0Kno90c82l87u5sNLXVp8KZpjIW1NQXphmFyaFgOIYPg7edB2Rgdh4fA1jacjp1JTtIEZa2zM4RPMoBkc8ihFlXHYCy257JiFsyh1FL4d3A0BKTp16nwCELYCZD4MEImD/EITJqBcxeVvrVIQXiJgJIS6WMmc3FMZUbI3Q1gUYR97A42IVUv@I5pNp6iqjnVrCgM6050kwbBCWzYMUF1UlhY0IQ3QVvHEhVsboMNdCb9tXBQOL0@/v6OKPboDsui9jpf@ufTc4jKQRv0HwG8lV9OQweLI18fng6Wn0P/n8Cw)
```
        DO ,1<-#1             PLEASE NOTE We want the input array to only have space for one element, so it will only take one at a time
        DO COME FROM (2)
        DO WRITE IN ,1        PLEASE NOTE If this is the first byte of the input, it'll write its value... but if not, it'll write the
                              previous value minus its value mod 256.
        DO .1<-,1SUB#1
        DO .5<-#1$!1~#256'    PLEASE NOTE .5 is 3 if the input is 256, 2 otherwise
        DO .2<-.3
        DO (1) NEXT
                              PLEASE NOTE If we're here, we've found the end of the input. Now, we need to print it back out... C-INTERCAL's
                              array I/O, in order to determine what it will actually print, subtracts the value it's going to print from the
                              previous one (still mod 256, and with the previous value defaulting to 0), and then reads the bits of the byte
                              backwards. So in order to go from the value we want to display to the value we need to feed into READ OUT, we
                              reverse the bits and then subtract from 256. Rather than select the bits out individually and mingle them all
                              in one expression, I mingle the back and front halves of the byte until it adds up to a reversal.
        DO .2 <- !3~#15' $ !3~#240'
        DO .2 <- !2~#15' $ !2~#240'
        DO .2 <- !2~#15' $ !2~#240'
        DO (1010) NEXT        PLEASE NOTE .1 already has 256 in it, which is very convenient for when you need to subtract .2 from 256.
        DO ,1SUB#1 <- .3      PLEASE NOTE If we just read .3 out, we'd get a Roman numeral instead of the correct output.
        DO READ OUT ,1
        DON'T GIVE UP         PLEASE NOTE Logical end of program. However, if we don't gracefully terminate here, nothing more is output,
                              and the FORGET can't keep up with the NEXTs.
    (1) DO (1002) NEXT        PLEASE NOTE that that line in syslib does 1001 next, which pops .5 entries off the next-stack and returns
                              control flow to the last one, such that if .5 is 2 flow will come back here, but if it's 3 then it'll go back
                              to the line that nexted to this one.
                              Here we add .1 and .2 into .3, then truncate it to a byte before looping back (while managing the next-stack
                              responsibly so the program doesn't disappear into the black lagoon for any input over 79 (?) bytes)
        DO (1009) NEXT
        DO .3<-.3~#255
    (2) DO FORGET #1
```
[Answer]
# [Python 3](https://docs.python.org/3/), 14 bytes
```
lambda x:x[-1]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fahvzPycxNyklUaHCqiJa1zD2f0FRZl6JRqqGkr2Spo4CkDaytDAxtTA0MjM3AYoUpxbYKsXkKWn@BwA "Python 3 ‚Äì Try It Online")
[Answer]
# [PHP](https://php.net/), 13 bytes
```
<?=$argn[-1];
```
[Try it online!](https://tio.run/##K8go@G9jX5BRoKCSWJSep2CroGRkaWFiamFoZGZuomStYG8HlLcFS0brGsZa//8PAA "PHP ‚Äì Try It Online")
Run with `php -nF` input is STDIN. Example:
```
$ echo 29845812674|php -nF lost.php
```
[Answer]
# Javascript, 14 bytes
```
a=>a.slice(-1)
```
[Answer]
# Bash + coreutils, 8 bytes
```
tail -c1
```
Input is from stdin, output is to stdout.
[Answer]
# [Turing Machine But Way Worse](https://github.com/MilkyWay90/Turing-Machine-But-Way-Worse), 391 bytes
```
1 0 1 1 0 0 0
0 0 0 1 1 0 0
1 1 1 1 0 0 0
0 1 0 1 2 0 0
1 2 1 1 0 0 0
0 2 0 1 3 0 0
1 3 1 1 0 0 0
0 3 0 1 4 0 0
1 4 1 1 0 0 0
0 4 0 1 5 0 0
1 5 1 1 0 0 0
0 5 0 1 6 0 0
1 6 1 1 0 0 0
0 6 0 1 7 0 0
1 7 1 1 0 0 0
0 7 0 1 8 0 0
1 8 1 1 0 0 0
0 8 0 0 9 0 0
0 9 0 0 a 0 0
0 a 0 0 b 0 0
0 b 0 0 c 0 0
0 c 0 0 d 0 0
0 d 0 0 e 0 0
0 e 0 0 f 0 0
0 f 0 0 h 0 0
0 h 0 0 g 0 0
0 g 0 0 0 1 1
1 g 1 0 0 1 1
```
[Try it online!](https://tio.run/##VdA9CsJAGIThPqcYewv3N/EG3sDamLgWkYAIOf66jqPwEdjhzZNiyesxblutDgc4fM72dDx/3Tk4Y99vvcwb87QgC8YCLcqisUhLsmQs0bIsG8u0XtYb62mDbDDGtziquLiouBhVXFxVXEwqLmYVFzcVF3cVF0VV8P/D7WZF92pV62lelnWP8/pcpl19Aw "Turing Machine But Way Worse ‚Äì Try It Online")
**EXPLANATION**
```
Detect eight zero bits (which will occur at the end of the input, since TMBWW uses an infinite tape of bits.)
1 1 1 1 0 0 0
0 1 0 1 2 0 0
1 2 1 1 0 0 0
0 2 0 1 3 0 0
1 3 1 1 0 0 0
0 3 0 1 4 0 0
1 4 1 1 0 0 0
0 4 0 1 5 0 0
1 5 1 1 0 0 0
0 5 0 1 6 0 0
1 6 1 1 0 0 0
0 6 0 1 7 0 0
1 7 1 1 0 0 0
0 7 0 1 8 0 0
1 8 1 1 0 0 0
0 8 0 0 9 0 0
-------------
When eight 0 bits are detected, move back to the final byte of the input and print it out while halting the program.
0 9 0 0 a 0 0
0 a 0 0 b 0 0
0 b 0 0 c 0 0
0 c 0 0 d 0 0
0 d 0 0 e 0 0
0 e 0 0 f 0 0
0 f 0 0 h 0 0
0 h 0 0 g 0 0
0 g 0 0 0 1 1
1 g 1 0 0 1 1
```
[Answer]
# TI-BASIC (TI-84), 10 bytes
```
sub(Ans,length(Ans),1
```
Gets the last character in the input string.  
Input is in `Ans`.  
Output is in `Ans` and is automatically printed out.
[Answer]
# Excel, 10 bytes
Pretty much equivalent to @remoel's VBA answer:
```
=RIGHT(A1)
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~9~~ 4 bytes
```
last
```
[Try it online!](https://tio.run/##y0gszk7NyfmfZhvzPyexuOR/bmJmnoKtQkFRZl6JgopCmoJSBlA@X@n/v@S0nMT04v@6yQUFAA "Haskell ‚Äì Try It Online")
[Answer]
# [Seed](https://esolangs.org/wiki/Seed), 11 bytes
```
5 370394306
```
[Try it online!](https://tio.run/##K05NTfn/31TB2NzA2NLE2MDs//@S1OKSzLx0AA)
The resulting Befunge-98 program `~2j@,` was stolen borrowed from *Jo King* [here](https://codegolf.stackexchange.com/a/181671/62313), so credit to them for that.
[Answer]
# [Mornington Crescent](https://esolangs.org/wiki/Mornington_Crescent), 389 Bytes
Even a task as simple as this presents an interesting optimisation challenge when riding the London Underground.
```
Take Northern Line to Bank
Take Circle Line to Bank
Take Central Line to Mile End
Take Central Line to Holborn
Take Piccadilly Line to Heathrow Terminals 1, 2, 3
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green
Take District Line to Mile End
Take Central Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent
```
[Try it online!](https://tio.run/##jZFBDoJADEX3nqIH0IV6AkWjCzEsuEAdGmkY2qQzCfH0OFGDC8Gwfv@3@f@3asJyjyorZxQcSez7EhuCq1qsyQQuLARRYY/SLF4oY3OexkCyG/qB5JxkR6nG6Vn9Lb1/w4Kdw4q9f3w5YaxNOyjJWhb0AdZL2CxhO2nZuZQESu0@Vw8corGL8wUFWlAJcDKiKc3/WDN6@uk2H2aAbJjBYyif)
Visiting Mile End station allows you to take a substring from the end of the input - but to chop just 1 character, you need to generate the integer 1 somehow. Rather than doing any arithmetic, the fastest method turns out to be to parse it from the station name "Heathrow Terminals 1, 2, 3".
To bypass that, an alternate strategy for this challenge would be to reverse the input, read the character code for the now first byte, and then turn that back into a char to output - but this approach takes 12 bytes longer. (Although there are fewer trips needed, so the tickets would be cheaper.)
[Answer]
# [Arn](https://github.com/ZippyMagician/Arn), 2 bytes
```
:}
```
Pretty simple, the suffix `:}` gets the last element of an array (implicit casting)
[Answer]
# Java 11+
Input from STDIN, ~~71~~ 61 bytes
-10 bytes thanks to OlivierGr√©goire
```
v->{var x=System.in;x.skip(x.available()-1);return x.read();}
```
[Try it online!](https://tio.run/##ZU49a8MwEN39K26UBgs6i3Rrtk6BLqHDWZaSSxTZnM6KivFvd1XoUChveG94Xzcs2N/G@@4i5gzvSGntKInngM7DcW0agvqYaISiQa48PTO8VednoSnZrZuXIZKDLCiNyo/x0VrUSZjS5fyJfMn/g2t3hACHvfSva0GGejh9ZfEPQ8lWk@80q2raN4o4RK90/6Ite1k4QTXscVTabrvtflPTImZuexKTUu6KrIMJKi0xam27bdtx@INATx7QfwM)
  
  
Function Argument, 25 bytes
```
s->s.charAt(s.length()-1)
```
[Answer]
# [><>](https://esolangs.org/wiki/Fish), 2 bytes
Using command line args
```
o;
```
[Try it online!](https://tio.run/##S8sszvj/P9/6////usUemQpuQL4iAA "><> ‚Äì Try It Online")
# [><>](https://esolangs.org/wiki/Fish), 11 bytes
Using stdin
```
\~o;
/?(0:i
```
[Try it online!](https://tio.run/##S8sszvj/P6Yu35pL317DwCrz/3@PTAU3oKgiAA "><> ‚Äì Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 1 byte
```
¬§
```
[Try it online!](https://tio.run/##yy9OTMpM/f//0JL//z1Sc3LyFQxMHZ0MXQE "05AB1E ‚Äì Try It Online")
`Œ∏` or ``` would also work.
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 6 bytes
```
pA/@po
```
[Try it online!](https://tio.run/##Sy5Nyqz4/7/AUd@hIP//fyNLCxNTC0MjM3MTAA "Cubix ‚Äì Try It Online")
```
  p
A / @ p
  o
```
[Watch it run](https://ethproductions.github.io/cubix/?code=ICBwCkEgLyBAIHAKICBvCg==&input=Mjk4NDU4MTI2NzQ=&speed=20)
* `A` Takes all the input
* `/` Redirect around the cube
* `pp` bring bottom of the stack to the top twice
* `o/@` output as character, redirect and halt
[Answer]
# [Befunge-93](https://github.com/catseye/Befunge-93), 12 ~~15~~ bytes
```
:1+_p1-,@>~#
```
[Try it online!](https://tio.run/##S0pNK81LT/3/38pQO77AUFfHwa5O@f9/I0sLE1MLQyMzcxMA "Befunge-93 ‚Äì Try It Online")
Thanks to @Jo King for golfing off 3 bytes.
[Alternate](https://tio.run/##S0pNK81LT/3/v87KUFu5TDGeS0HBQUfF5v//5MS8ktSc/NKCVAA "Befunge-93 ‚Äì Try It Online") 15 byte version that is less messy:
```
~:1+#v!_
  @,$<
```
Taking strings as input in Befunge isn't the easiest. If there were a single command to take in multiple characters, it would be as simple as reading the string, popping/printing the top character, and exiting.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 1 byte
```
·π™
```
[Try it online!](https://tio.run/##y0rNyan8///hzlX///8vzs9NVShKzEvJz1XIzCsoLVEEAA "Jelly ‚Äì Try It Online")
Not the most difficult challenge in Jelly...
Note this accepts the input as a string; if the input could be interpreted otherwise (e.g. a number, a list), then it the argument will need to be quoted (e.g. "123456" or "[123,197]"). Alternatively this can be seen as a link that takes a byte array and returns the last member of that array, in accordance with PPCG standard rules.
Thanks to @MilkyWay90 and @·Éë·Éò·Éõ·Éù for pointing this out.
[Answer]
# [Emotion](https://github.com/Quantum64/Emotion), 5 [bytes](https://quantum64.github.io/EmotionBuilds/1.1.0//?state=JTdCJTIybW9kZSUyMiUzQSUyMmNvZGVwYWdlJTIyJTdE)
```
üò∂üëâüòÉüò®üëø
```
Explanation
```
üò∂ Push a copy of the first stack value.
üëâ Push the length of the first stack value interpreted as a string.
üòÉ Push literal 1
üò® Push the difference of the second and first stack values.
üëø Push the character of the second stack value at the index of the top stack value.
```
[Try it online!](https://quantum64.github.io/EmotionBuilds/1.1.0//?state=JTdCJTIyaW50ZXJwcmV0ZXJDb2RlJTIyJTNBJTIyJUYwJTlGJTk4JUI2JUYwJTlGJTkxJTg5JUYwJTlGJTk4JTgzJUYwJTlGJTk4JUE4JUYwJTlGJTkxJUJGJTIyJTJDJTIyaW50ZXJwcmV0ZXJBcmd1bWVudHMlMjIlM0ElMjIyOTg0NTgxMjY3NCUyMiUyQyUyMm1vZGUlMjIlM0ElMjJpbnRlcnByZXRlciUyMiU3RA==)
[Answer]
# [Cascade](https://github.com/GuyJoKing/Cascade), 9 bytes
```
?a|,
;.]^
```
Pretty happy with this, as it is only 3 bytes longer than [my cat program](https://codegolf.stackexchange.com/a/193480/87923)
# Expanded
```
   ?
  ^;.
 | |a
 ] |
a ,|
```
This essentially just loops through pushing input characters into the `a` stack until EOF is reached. Then it outputs the item at the top of the `a` stack using `.a`.
[Try it online!](https://tio.run/##S04sTk5MSf3/3z6xRofLWi827v//xKTklNS0dAA "Cascade ‚Äì Try It Online")
[Answer]
## Rust, 25 16 10 bytes
```
|s|s.pop()
```
[Try it on the Rust Playground!](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=%0Afn%20main()%7B%0A%20%20%20%20println!(%22%7B%3A%3F%7D%22%2C%0A%20%20%20%20%20%20%20%20vec!%5B%22Hello%2C%20World%22.to_string()%2C%22%3F%22.to_string()%2C%2229845812674%22.to_string()%5D%0A%20%20%20%20%20%20%20%20.iter_mut()%0A%20%20%20%20%20%20%20%20.map(%7Cs%7Cs.pop())%0A%20%20%20%20%20%20%20%20.collect%3A%3A%3CVec%3COption%3Cchar%3E%3E%3E()%0A%20%20%20%20)%3B%0A%7D)
An anonymous function that takes in a mutable String and outputs the char at the end of the string. Minus a lot of bytes, thanks to madlaina
[Answer]
# PowerShell, 11 bytes
```
"$args"[-1]
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X0klsSi9WCla1zD2////ILF8hfL8opwUAA "PowerShell ‚Äì Try It Online")
[Answer]
# SmileBASIC, 16 bytes
```
INPUT S$?POP(S$)
```
[Answer]
# Twig, 37 bytes
This just uses a simple "extract 1 char from the end and print it" aproach.
```
{%macro a(a)%}{{a[-1:1]}}{%endmacro%}
```
It was really easy to do, and test, but was fun!
---
To use it, you have to put it on a `.twig` file and import it:
```
{% import 'a.twig' as a %}
{{ a.a("string") }} {# should display "g" #}
```
You can test it on <https://twigfiddle.com/aa19wd> (testcases included)
[Answer]
# Bash, 13 bytes
```
echo ${1: -1}
```
string is passed as argument. 
[Try it online !](https://tio.run/##S0oszvj/PzU5I19BpdrQSkHXsPb///@JSckpqWnpGQA)
[Answer]
# APL+WIN, 4 bytes
```
¬Ø1‚Üë‚éï
```
Prompt for input string and select last byte.
]