Questions Concepts
GitHub icon

Binary Literals

Binary Literals - language feature

< >
Example from Java, AspectJ, Pizza, Oracle Java, Deesel:
// 0[bB][01][01_]*[lL]?
Example from JavaScript, TypeScript:
// 0[bB][01]+n? 0b100110100000110011110010010
Example from Python, Cython:
# 0[bB](?:_?[01])+
Example from Perl:
# 0b[01]+(_[01]+)*
Example from MySQL:
-- b'[01]+'
Example from Swift:
// 0b[01_]+
Example from Haskell:
-- 0[bB]_*[01](_*[01])*
Example from Julia:
# 0b[01]+((_[01]+)+)?
Example from Prolog, CLPR, GAEA, Progol:
% 0b[01]+
Example from Elixir:
# 0b[01]+
Example from Verilog:
// ([0-9]+)|(\'b)[01]+
Example from Reason, MiniD, Croc:
// 0[bB][01][01_]*
Example from F#:
// 0[bB][01][01_]*[uU]?[yslLn]?
Example from Eiffel:
-- 0[bB][01]+
Example from D:
// 0[Bb][01_]+
Example from VHDL:
-- B"[01_]+"
Example from Chapel:
// 0[bB][01]+
Example from Monkey:
' \%[10]+
Example from Ceylon:
// \$([01]{4})(_[01]{4})+
Example from SystemVerilog:
// ([1-9][_0-9]*)?\s*\'[sS]?[bB]\s*[xXzZ?01][_xXzZ?01]*
Example from C3:
Example from Speedie:
|| num = 0b010101
Example from K:
/ [01]+b
Example from Felix:
// 0[Bb][01_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?
Example from Jule:
Example from Whiley:
// [01]+b

Languages with Binary Literals include Java, JavaScript, Python, Perl, MySQL, Swift, Haskell, TypeScript, Julia, Prolog, Elixir, Verilog, Reason, F#, Eiffel, OCaml, D, VHDL, Chapel, Coq, Monkey, BlitzBasic, Zig, Opa, Ceylon, F*, SystemVerilog, Cython, Isabelle, MiniD, C3, Speedie, AspectJ, Croc, K, Futhark, Felix, Jule, Pizza, BlitzMax, ooc, Whiley, Logtalk, Earl Grey, parasail, FloScript, Savi, CLPR, nimrod, CBOR data definition language, Oracle Java, Deesel, GAEA, Progol

Languages without Binary Literals include progsbase

This question asks: Does the language have a type and syntax for binary numbers?

Read more about Binary Literals on the web: 1.

HTML of this page generated by Features.ts

View source

- Build the next great programming language Search Add Language Features Creators Resources About Blog Acknowledgements Queries Stats Sponsor Traffic Traffic Today Day 305 Logout