Sept. 17, 2023, 3:07 a.m. | Retiago Drago

DEV Community dev.to




Question 1


I wonder if the order matters for the declaration of functions in Dart. So I asked ChatGPT on this one. Let's suppose this code exists:



void main() {
greet();
}

void greet() {
print('Hello!');
}



If I swap the order, does the Dart program throw an error or work just fine?






ChatGPT Reply 1



In Dart, the order in which functions are declared does not matter. Dart supports hoisting, which means you …

beginners chatgpt code codenewbie dart error functions hello matter python

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Developer AI Senior Staff Engineer, Machine Learning

@ Google | Sunnyvale, CA, USA; New York City, USA

Engineer* Cloud & Data Operations (f/m/d)

@ SICK Sensor Intelligence | Waldkirch (bei Freiburg), DE, 79183