Confusing Imports in the Code

I have just finished Fundamentals II course here. In the last few exercises, the arrays like names of books, ice-cream flavours, hotels, etc was imported from somewhere. This confused me. I suggest that Grasshopper either should explain it properly or give all the required information in the starting code itself. All those who approve or disapprove of my suggestion are free to comment on this. Thanks!

Hello,
Please, I’m having similar difficulty as the one above.
I’m really finding hard understanding the ‘import’ statement and how it works.

Also, can I create my own code and import it.
If yes, how?

1 Like

Hey there,

In the mobile app, screen space is quite limited, and it’s important that the code we do show is directly relevant to the lesson being taught. For this reason, we’ll often put irrelevant code into a hidden code section, and then import it into the lesson.

This way we can use large arrays or objects, helper functions, or anything else that might eat up a lot of valuable space.

For more information on importing and exporting modules of code, here’s a video that explains it pretty well!

Hope this helps!
Ben

2 Likes

Hello team,
Please I’m having difficulty understanding the use of the ‘import’ statement.

Please can one explain how it works.
Also, how can I create my own code to import.