Multiple Languages highlighting
Excel Formulae
I5=SUMPRODUCT(--(C5:C14="red"),F5:F14)
I6=SUMPRODUCT(--(B5:B14="tx"),--(C5:C14="red"),F5:F14)
I7=SUMPRODUCT(--(B5:B14="co"),--(C5:C14="blue"),F5:F14)
BASIC
Dim wb as workbook
For Each wb In Application.Workbooks
If not wb.ReadOnly then
wb.Save
End if
Next wb
Pure BASIC
NewList Number()
AddElement(Number())
Number() = 10
AddElement(Number())
Number() = 20
AddElement(Number())
Number() = 30
ForEach Number()
Debug Number() ; Will output 10, 20 and 30
Next
LISP
(if nil
(list 1 2 "foo")
(list 3 4 "bar"))
(or (and "zero" nil "never") "James" 'task 'time)
(defun should-be-constant ()
'(one two three))
(let ((stuff (should-be-constant)))
(setf (third stuff) 'bizarre)) ; bad!
(should-be-constant) ; returns (one two bizarre)
Dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:18.04
COPY . /app
RUN make /app
CMD python /app/app.py
Erlang
%% Demonstrates type testing, selector, updating.
birthday(P) when is_record(P, person) ->
P#person{age = P#person.age + 1}.
register_two_hackers() ->
Hacker1 = make_hacker_without_phone("Joe", 29),
OldHacker = birthday(Hacker1),
% The central_register_server should have
% an interface function for this.
central_register_server ! {register_person, Hacker1},
central_register_server ! {register_person,
OldHacker#person{name = "Robert",
phone = [0,8,3,2,4,5,3,1]}}.
Elixir
1 = hd([1, 2, 3, 4])
# alternatively use pattern matching
[head | tail] = [1, 2, 3, 4]
# head contains 1
"true is always true" = cond do
0 > 1 -> "No"
0 > 2 -> "Nope"
true -> "true is always true"
end
OCaml
(* single line comment *)
# let rec sort = function
| [] -> []
| x :: l -> insert x (sort l)
and insert elem = function
| [] -> [elem]
| x :: l -> if elem < x then elem :: x :: l
else x :: insert elem l;;
val sort : 'a list -> 'a list = <fun>
val insert : 'a -> 'a list -> 'a list = <fun>
(* multiple line comment, commenting out part of a program, and containing a
nested comment:
let f = function
| 'A'..'Z' -> "Uppercase"
(* Add other cases later... *)
*)
About the author
I am a Self-Taught and Passionate FullStack Developer from Bangalore, India. ReactJS, JavaScript, Ruby on Rails, HTML, and CSS.