battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programming a forum for elite programmers with extreme will power to sharpen their skills
HomeGallerySearchRegisterLog in

 java finally is defer on swift

Go down 
Moti Barski
Moti Barski

Posts : 573
Join date : 2011-08-02

java finally is defer on swift Empty
PostSubject: java finally is defer on swift   java finally is defer on swift EmptyMon Nov 19, 2018 1:35 pm

   public static String enStar(String word) {
      Boolean fin = false;

      String result = "";
      for (int i = 0; i < word.length() + 2; i++) {
         result += "*";
      try {
         return result;
      finally {
         // this code line runs always before the return, the same as defer in the
         // swift  programming language
         System.out.println("why is this running twice ?!");

see comments in the function above


MB over and out emp it up
Back to top Go down
java finally is defer on swift
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: