Advertisement
MyPix

Spark prototype

Sep 12th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import Spark; // Importe toute les définitions externe à Spark, par exemple les variables "raccourci" comme endl (qui se traduirait par "/n", sera très peu inutile et pourra être omis dans les premieres versions de spark)
  2. using scope Spark.*; // Utilisera tout les scopes disponibles dans Spark. pour éviter les noms pompeux style Spark.io.print
  3. define scope MyStuff
  4. {
  5. string myFunction()
  6. {
  7. return "Hello, ";
  8. }
  9. float pi = 3.1415;
  10. }
  11. using scope MyStuff;
  12. int main()
  13. {
  14. print << MyFunction() << endl; // Le nom pompeux serait : Spark.io.print << MyStuff.myFunction() << Spark.io.endl;
  15. print << "Let's play ! Give me Pi with 4 decimals !" << endl;
  16. if(pi==getline())
  17. {
  18. print << "Correct !" << endl;
  19. }
  20. else
  21. {
  22. print << "Hmmm..too bad :/" << endl;
  23. }
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement