How about you try to understand others?
People have given essay length type explanations and you denied every one. If its a language barrier issue there’s an inbuilt tpage translator
How about you try to understand others?
People have given essay length type explanations and you denied every one. If its a language barrier issue there’s an inbuilt tpage translator
They’re obviously trolling this is too funny
have you seen the scripting support and code review sections of this forum…?
Ahem
this takes the last number of the number and checks if its even or not (the number is in a string because if it wasnt then the number was too big for roblox)
function isEven(number)
local stringNum = tostring(number)
local firstNumber = stringNum:sub(#stringNum,#stringNum)
return tonumber(firstNumber) % 2 == 0
end
print(isEven("111111111111111321454554353425433333333432578342786354287635478635428763452634528763458760"))
--returns true because the last nubmer "0" is even
I dont know sorry, I no really understand some of words you said.
I thought of this too. To bad no one is actually looking to learn anyhing in this post.
Maybe Robox could add a … Ridiculously Childish section.
Well if you know how the modulo (%) works you will understand.
The modulo (%) is associated with division.
Here’s an example:
Equation: 4 % 2
hmm idk lemme do division
4 / 2 = 2
alr the remainder of that is 0 cuz nothing is left over
Imagine you have 10 cookies and you want to share them equally with 3 friends. Each friend would get 3 cookies, and you’d have 1 cookie left over.
In math, this leftover cookie is like the “remainder” when you divide. We call this division with a remainder “modulo.”
So, if we say “10 modulo 3,” we’re asking, “What’s the remainder when we divide 10 by 3?”
In this case, the remainder is 1. So, 10 modulo 3 is 1. It’s like asking, “How many are left after sharing equally?”
Your is far from easy to understand (Like yes its easy but its…), his one is easier to be honest
this resource has been great, but numbers in my game are now heading into the billions. think you could do me a solid and update it a more?
Uhhh, wanna see?
Let’s do the math:
2024*2 = 4048
You said a number with 294 zeros so I pick this number:
10^294
Finally I have to multiply 4048 by 10^294, here’s the result:
4.048e+297
based on idk what
sun dies in a few billion years (idk sometimes i hear 5 billion sometimes 7 billion, idk)
either way, that’s only 9 zeros
that is a far cry from 297
Adding onto this post. This is the best method of finding even numbers:
local function CheckEvenOdd(x:string) -- The super cute number finder.
x = tostring(x)
if #x > 100 then
return "Number is too big for me. >w<" -- I am not a black hole. Give me something easily digestable!!
elseif #x < 2 then
return "Number is too small for me. >w<" -- You need to get better at providing bigger stuff.
end
x = string.reverse(x)
x = string.sub(x,1,1)
local the_last_Digit_of_x = tonumber(x) -- The last digit. The chosen one!!
local all_the_even_digits_till_ten = { -- My feelings for even numbers. x3
[0] = "Master Zero",
[2] = "Senpai Two",
[4] = "Oni-Chan Four",
[6] = "Daddy Six",
[8] = "Mommy Eight",
}
local all_the_odd_digits_till_ten = { -- My feelings for odd numbers. (ew)
[1] = "Uncle One",
[3] = "Annoying Three",
[5] = "Peasant Five",
[7] = "Overrated Seven",
[9] = "Ugly Nine",
}
local the_potential_odd_last_digit_of_x = all_the_odd_digits_till_ten[the_last_Digit_of_x] -- Is x an odd number? (ew)
local the_potential_even_last_digit_of_x = all_the_even_digits_till_ten[the_last_Digit_of_x] -- Is she an even? (:OOO)
if the_potential_even_last_digit_of_x then -- Is she even?
return "Oooo... the number is even!! OwO Because your number ends with "..the_potential_even_last_digit_of_x
elseif the_potential_odd_last_digit_of_x then -- Is she even a girl?
return "Awwwwww... the number is a filthy odd one... >_< Because your number ends with "..the_potential_odd_last_digit_of_x
else -- No... she must be trans then!! <3
return "Um... THE NUMBER IS TRANSGENDER! HOW DARE YOU ASSUME THEIR GENDER! HUH!? I AM GOING TO CANCEL YOU NOW! NOW NOW NOW!!!!"
end
end -- The end. :p
This script, while being the MOST accurate method of finding odds and even, also tells me why the number is odd or even.
this will help you support an infinite amount of numbers
--!native
local ServerStorage = game:GetService("ServerStorage")
local SUPPORT_COUNT = 100 -- Number Of Generated If Statments
local txt = "local ifEven \nlocal ifUnEven \nlocal number \nif number == 0 then \n\tifEven\n"
local scriptCopy = Instance.new("Script", ServerStorage)
for i=1, SUPPORT_COUNT do
txt = txt .. `elseif number == {i} then\n\t{i % 2 ==0 and "ifEven" or "ifUnEven"}\n`
end
txt = txt .. 'else\n\tprint("Unsopported number")\nend'
scriptCopy.Source = txt
add this script in server script service and run this command in the command line
loadstring(game.ServerScriptService.Script.Source)()
once you run it a new script will be generated in server storage change the variable SUPPORT_COUNT
to the amount of numbers that you want to support
the problem is when generating the script, for
loops aren’t as performant as handwritten code (source: me). you should instead just copy the needed line as many times as needed.
then to optimise that, you create a script to automate the creation of those lines.
but then to automate those lines it becomes less performant
so just write them all out by hand again
the for loop was able to create 5k lines in only <4 seconds
you will take hours to do the same if you handwritten the code
yes but it’s not as performant at runtime
also copy-pasting can result in errors
so typing it out is by far the best way to go
you cant edit a script source at run time so.
buuut the overall computation time is longer isn’t it
so handwritten way better
the computer will write it faster than a human
you may take an hour to write 5k lines while a computer can write it in <5 seconds