Search all within opened tabs with Sublime Text 2
Yes.
Ctrl⇧+F on Windows/Linux or ⌘⇧+F on a Mac.
or just go to the menu "Find" and use the option almost at the bottom called "Find in Files".
To search in all open files, add this to the Where textbox:
<open files>
If you want to search in folders and such, please just look at the right of the textbox and see there's a button ...
. Click on it and it will show you options.
Related videos on Youtube
Jen123
Updated on September 18, 2022Comments
-
Jen123 over 1 year
public static double sumGeom(double term, double ratio, int n) { double sum = 0; if (n<=1) { return term; } else { sum = sum + term * ratio; return sumGeom(term * ratio, ratio, n-1); } } } //Geometric sequence: 2 4 8 16 32 //Geometric sum: 62
I am a beginner to Java, and my assignment was to find the sum of a geometric sequence using recursion only.
The parameters are: term = 2, ratio = 2 and n = 5. Above is the code that I attempted. I am having a very hard time visualize how recursions work, so I do not know what went wrong with my code. Instead of giving me the desired answer of 62, I am getting 32 instead. What is wrong with this code?
I have tried this version as well but am still getting 32 instead of 62:
public static double sumGeom(double term, double ratio, int n) { double sum = 0; if (n<=1) { return term; } else { return sum = sum + sumGeom(term * ratio, ratio, n-1); } } }
-
Jean-François Savard over 6 yearsWhat parameters are you passing to the method?
-
Thomas Weller over 6 yearsDo you know what a debugger is? Run your code under the debugger and go through it step by step. You'll learn a lot.
-
Tom over 6 yearsWouldn't it be clever to actually do something with
sum
? Like using it to calculate the return value? -
Kacper Wiszczuk over 6 yearsThis is because you are ignoring 'sum' variable in recursion calls, and you end up with returning only last item from geometric sequence. You should rather return sum + sumGeom(...).
-
Jen123 over 6 yearsI returned sum + sumGeom(...) but it still doesn't work
-
Tom over 6 yearsNow come on, please think before trying random stuff. Your
sum
will always be0.0
, what do you expect here?
-
-
lucas over 7 yearsMamsaac's answer is also supported in Sublime Text 3, for those who are wondering.
-
jan deeg almost 6 yearsWhen I try this (Sublime Text 3.1.1 on Mac OS), it doesn't search all open tabs; it only searches open tabs within the current window.
-
AlexLaforge about 3 yearsYou can also leave the "WHERE" text box Empty instead of typing
<open files>
.