本页尚未翻译,以下为英文原文。
#E0004: literal out of range for its type
A literal does not fit its type: 300u8, -1 where an unsigned type is expected, or a float too large for f32. Use a wider type (300u16), a value that fits, or an int for a number of any size.
nabi
let b: u8 = 300;
error[E0004]: integer literal `300` out of range for `u8` --> main.nabi:1:13 | 1 | let b: u8 = 300; | ^^^
Use a type wide enough for the value:
nabi
let b: u16 = 300;
println(f"{b}");
300
Related: E0003 malformed numeric literal, E0040 mismatched types
Found a mistake? Edit this page on GitHub. Last updated