Skip to content
Justice Tech School

Type Conversion

int.parse, double.parse, tryParse, toString, toInt and toDouble convert values.

Example
print(int.parse("42") + 1);
print(double.parse("3.5"));
print(int.tryParse("x"));
print(7.toDouble());
print(3.99.toInt());
print(42.toString() + "!");

Exercise

Safe parse.

int.("5")

Quiz Test

What does tryParse give for bad input?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.