PLDB
Languages Features Creators Calendar CSV Resources Blog About Donate Add Language
GitHub icon

Type Casting

< >
double da = 3.3; double db = 3.3; double dc = 3.4; int result = (int)da + (int)db + (int)dc; //result == 9
Example from MATLAB:
b = cast(a, 'like', p)
Example from C#:
Animal animal = new Cat(); Bulldog b = (Bulldog) animal; // if (animal is Bulldog), stat.type(animal) is Bulldog, else an exception b = animal as Bulldog; // if (animal is Bulldog), b = (Bulldog) animal, else b = null animal = null; b = animal as Bulldog; // b == null
<number>something;
Example from C3:
double d = 3.3; int x = (int)d;
Example from Jule:
let x = (int)(3.14)

Languages with Type Casting include C, C++, MATLAB, C#, TypeScript, Objective-C, C3, Jule, Tick C, cooC, Real-Time Concurrent C, Static Typescript

Read more about Type Casting on the web: 1.

HTML of this page generated by Features.ts

hasExceptions.html 路 hasExplicitTypeCasting.html 路 hasExports.html

View source

PLDB - Build the next great programming language Search v2023 Day 157 Docs Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com