Cairo Data Types
Overview
Explain Cairo's core data types, literals, and conversions so answers stay type-correct and safe.
Quick Use
- •Read
references/data-types.mdbefore answering. - •State the target type explicitly and show the correct literal or conversion.
- •Prefer integer types over
felt252when safety (overflow/underflow checks) matters.
Response Checklist
- •Identify whether the value should be
felt252, a specific integer type,bool, a string type, or a compound type. - •When literals are ambiguous, use a type suffix or explicit annotation.
- •For conversions, show
try_into/intopatterns and mention potential failure where relevant.
Example Requests
- •"What is the difference between
felt252andu64in Cairo?" - •"How do I write a short string vs a long string?"
- •"Why does this integer literal need a type annotation?"